Giter VIP home page Giter VIP logo

life's Introduction

回顾一生

准备工作

  • gasp
  • 主题色
  • 配置界面

GSAP

gsap for react

api

单点动画

https://greensock.com/docs/v3/GSAP/Tween/vars

// 从原点做动画到某处
gsap.to(boxRef.current, {
  rotation: '+=270', // string 相对于原值, number 绝对值
  duration: 2,
  delay: 1,
  x: '-=300', // string 相对于原值, number 绝对值
  opacity: 0,
});

// 从某个位置做动画回到原点
gsap.from(boxRef.current, {
  rotation: '+=270',
  duration: 2,
  delay: 1,
  x: '-=300',
});

// 从哪到哪
tweenRef.current = gsap.fromTo(
  boxRef.current,
  {
    x: -1100,
  },
  {
    rotation: '+=270',
    duration: 2,
    delay: 1,
    x: 300,
  },
);

// 返回实例,可以在任意地方做操作
tweenRef.current.pause();
tweenRef.current.seek(2); // 跳转到一个特定的时间,而不影响是否暂停或反转实例
tweenRef.current.progress(0.5); // 设置动画的状态, 0未开始 .5 走到一半 1完成
tweenRef.current.play();

连续性动画

// 按顺序执行
const boxRef = useRef<any>();
const q = gsap.utils.selector(boxRef);
const tl = useRef<any>();
  
useEffect(() => {
  tl.current = gsap
  .timeline()
  .to(q('.ani1'), {
    rotate: 360,
    duration: 5,
  })
  .to(q('.ani2'), {
    x: 100,
    duration: 5,
  });
}, [])

<div className="box" ref={boxRef}>
  <span className="ani1">Hello1</span>
  <span className="ani2">Hello2</span>
</div>

进度

渲染端

  • 动画渲染核心
  • 动态加载组件

配置端

配置模块 模板模块

life's People

Contributors

kujo-jotaro-aaaaa avatar freezestanley avatar

Watchers

James Cloos avatar  avatar

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.