当前位置:网站首页>gsap动画库
gsap动画库
2022-07-07 16:36:00 【小菜鸟学代码··】
gsap动画库
首先导入gsap动画库
npm i gsap -S
安装好了在项目中引用import gsap from "gsap"
普通的页面使用

gsap.to('类名',{
动画属性})
//我们也可以使用时间线来写动画
//创建一个时间线 ,然后再使用链式语法,做过视频剪辑的同学可能理解的更深
var tl = gsap.timeline();
tl.to(".box1", {
rotation: 27, x: 100, duration: 10 }).to(".box1", {
rotation: 27, x: 100, duration: 10 });
THREE界面的使用
//cube是实例化的3d物品 gsap.to反应的是物体的结果
let tl = gsap.timeline()
let ani = tl.to(cube.position, {
x: 500, duration: 3,
ease: "power1.inOut",
yoyo: true,
repeat: -1,
delay: 2,
onComplete: () => {
console.log(1); },
onStart: () => {
console.log('开始了');
}
})
//双击屏幕监听
window.addEventListener('dblclick', () => {
console.log(ani.isActive());//是否处于运动状态
if (ani.isActive()) {
ani.pause() //动画停止
} else {
ani.resume()//动画恢复
}
})
ease是速率repeat重复次数 -1 无限循环yoyo往返运动delay延时运动onComplete是完成时候做的一个回调函数onStart是开始时候做的一个回调函数
边栏推荐
- Download, installation and development environment construction of "harmonyos" deveco
- Wireshark分析抓包数据*.cap
- [principle and technology of network attack and Defense] Chapter 1: Introduction
- 2022年理财有哪些产品?哪些适合新手?
- 性能测试过程和计划
- 通过 Play Integrity API 的 nonce 字段提高应用安全性
- The highest level of anonymity in C language
- Tips for this week 131: special member functions and ` = Default`
- 简单几步教你如何看k线图图解
- 你真的理解粘包与半包吗?3分钟搞懂它
猜你喜欢

Machine vision (1) - Overview

The highest level of anonymity in C language

Pro2: modify the color of div block

Chapter 3 business function development (user login)

What skills can you master to be a "master tester" when doing software testing?

Ten thousand words nanny level long article -- offline installation guide for datahub of LinkedIn metadata management platform

Mui side navigation anchor positioning JS special effect

线程池和单例模式以及文件操作

debian10编译安装mysql
![[principle and technology of network attack and Defense] Chapter 6: Trojan horse](/img/2f/bd35ca141fad5c85f78fd6340ada1d.png)
[principle and technology of network attack and Defense] Chapter 6: Trojan horse
随机推荐
【蓝桥杯集训100题】scratch从小到大排序 蓝桥杯scratch比赛专项预测编程题 集训模拟练习题第17题
Do you really understand sticky bag and half bag? 3 minutes to understand it
你真的理解粘包与半包吗?3分钟搞懂它
AI defeated mankind and designed a better economic mechanism
Easy to understand [linear regression of machine learning]
SQLite SQL exception near "with": syntax error
PIP related commands
[trusted computing] Lesson 11: TPM password resource management (III) NV index and PCR
[trusted computing] Lesson 13: TPM extended authorization and key management
海量数据去重的hash,bitmap与布隆过滤器Bloom Filter
[principle and technology of network attack and Defense] Chapter 7: password attack technology Chapter 8: network monitoring technology
上市十天就下线过万台,欧尚Z6产品实力备受点赞
[answer] if the app is in the foreground, the activity will not be recycled?
Unlike the relatively short-lived industrial chain of consumer Internet, the industrial chain of industrial Internet is quite long
[principles and technologies of network attack and Defense] Chapter 5: denial of service attack
[PaddleSeg源码阅读] PaddleSeg Validation 中添加 Boundary IoU的计算(1)——val.py文件细节提示
简单几步教你如何看k线图图解
Usage of PHP interview questions foreach ($arr as $value) and foreach ($arr as $value)
[paddleseg source code reading] add boundary IOU calculation in paddleseg validation (1) -- val.py file details tips
体总:安全有序恢复线下体育赛事,力争做到国内赛事应办尽办