Coder Social home page Coder Social logo

dobyming.github.io's Issues

[feat]fade animation in About Page

fade animation in About Page

목적

스크롤을 할때 target element가 viewport에 잡힐때마다 fade 되는 효과를 주고자 함

즉 타겟 엘리먼트를 h1 태그로 잡았을때, viewport상에 h1이 잡히면(True) 애니메이션이 적용이 되지 않고 만약 viewport 상에 잡히지 않는다면(False) scroll 시 해당 애니메이션이 적용된다.

어떻게?

1. fade animation

animation-timelinescroll() 속성을 활용할 예정

코드 snippet은 다음과 같음

import { css, keyframes } from '@emotion/react'

const fade = keyframes`
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
  `
  
const exampleDiv = styled.div`
  p {
    animation: fade 1s linear;
    animation-timeline: scroll();
  }
`

2. IntersectionObserver API

scroll 시, 특정 animation을 적용하기 위해선 해당 API를 활용할 것임

참고

IntersectionObserver API
삼항연산자를 활용한 keyframes

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.