GithubHelp home page GithubHelp logo

kitamuradev / sample-developer-portfolio Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 241 KB

Sample Developer Portfolio

Home Page: https://sample-developer-portfolio.vercel.app

JavaScript 0.17% Astro 98.64% SCSS 1.19%
astro gsap lottie lottie-web scss

sample-developer-portfolio's People

Contributors

kitamuradev avatar

Watchers

 avatar

sample-developer-portfolio's Issues

add color pallet

<style is:global>
  :root {
    --color-primary: #0EA5E9;
    --color-background-body: #0B1121;
    --color-background-workbox: #112240;
    --color-section-line: #233554;
    --color-section-headtext: #CCD6F6;
    --color-basetext: #8892B0;
  }

  html {
    font-size: 100%;
    scroll-behavior: smooth;
  }

  body {
    background-color: var(--color-background-body);
    color: var(--color-basetext);
  }
</style>

setup scss files

_mediaquery.scss

$breakpoints: (
  'sm': 'screen and (width <= 520px)', // 520px以下(520pxも含む)
  'md': 'screen and (width <= 768px)', // 768px以下(768pxも含む)
) !default;

@mixin mq($breakpoint) {
  @media #{map-get($breakpoints, $breakpoint)} {
    @content;
  }
}

_functions.scss

// example - rem(24) => 1.5rem
@function rem($fontSize) {
  @return calc($fontSize / 16) * 1rem;
}

// hover wrapper
@mixin hover {
  @media (hover: hover) and (pointer: fine) {
    @content;
  }
}

_global.scss

// line height
$lh_sm: 1.4 !default;
$lh_md: 1.5 !default;
$lh_lg: 1.6 !default;
$lh_xl: 1.7 !default;
$lh_2xl: 1.8 !default;

// font size
// letter spacing

スクロールに応じてヘッダーの表示/非表示を制御する

let prevScrollPos = window.pageYOffset;

window.addEventListener("scroll", function() {
  let currentScrollPos = window.pageYOffset;
  if (prevScrollPos > currentScrollPos) {
    // 上にスクロールしている場合、ヘッダーを表示する
    document.querySelector("header").style.top = "0";
  } else {
    // 下にスクロールしている場合、ヘッダーを非表示にする
    document.querySelector("header").style.top = "-100px";
  }
  prevScrollPos = currentScrollPos;
});

ローディングアニメーション実装

基本方針は lottie web に ローカルのjsonファイル を食わせる



アニメーション アセット


ローディング中は画面スクロールさせない実装

window.addEventListener("load", () => {
  document.body.style.overflow = "hidden";

  setTimeout(() => {
    const loader = document.querySelector(".loader");
    loader.style.display = "none";
    document.body.style.overflow = "visible";
  }, 3800);
});

サイドバーを背景タップで閉じる

document.querySelector("#content").addEventListener("click", () => {
        document.querySelector('.header__menu__btn').classList.remove("is-active");
        document.querySelector('.header__menu__aside').classList.remove("is-active");
        document.body.classList.remove("blur");
});

【GSAP】複数の要素をつなげてフェードインさせるアニメーション

  • アニメーションを繋げる
    • timeline() を使う
    • 第一引数の delay はアニメーションの開始時間
    • stagger で delay の値を加算(例:要素1は 0.6, 要素2は0.9 ...)
  • 要素単体にフェードインアニメーションをかける場合は from() メソッドのみでいい
gsap
  .timeline({
    delay: 3.8,
  })
  .from(".fade-in", {
    opacity: 0,
    y: 10,
    duration: 0.5,
    ease: "power2.inOut",
    stagger: 0.2,
  });

media query の記法を修正

media query range(範囲)記法から従来の記法に戻します

  • range 記法がなぜかモバイル版Chromeで機能していなかった
  • media query は Sass の @mixin で書いているので従来の記法に戻したとしても開発に支障はないと判断したため

デザイン修正

  • letter-spacing の付け忘れ(hero__cta)
  • 任意の単語の色を primary に変える(hero__text)

バグ修正

以下のバグを修正する

  • サイドバー展開時にスクロールできてしまう
  • サイドバーの位置がおかしい
    • header__nav fade-in__header で付与しているフェードインアニメーションが影響している
    • インラインに transform: translate(0px, 0px) が付与されてしまうことが原因
    • にフェードインアニメーションを付与するのではなく、`header__nav-list__item` にフェードインアニメーションをかける([参考](https://brittanychiang.com/))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.