当前位置:网站首页>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是开始时候做的一个回调函数
边栏推荐
- Tips of the week 136: unordered containers
- What are the financial products in 2022? What are suitable for beginners?
- SD_DATA_RECEIVE_SHIFT_REGISTER
- 云景网络科技面试题【杭州多测师】【杭州多测师_王sir】
- Live broadcast software construction, canvas Text Bold
- Kirk Borne的本周学习资源精选【点击标题直接下载】
- golang 客户端服务端登录
- Summary of evaluation indicators and important knowledge points of regression problems
- [network attack and defense principle and technology] Chapter 4: network scanning technology
- [trusted computing] Lesson 12: TPM authorization and conversation
猜你喜欢

【蓝桥杯集训100题】scratch从小到大排序 蓝桥杯scratch比赛专项预测编程题 集训模拟练习题第17题

Summary of evaluation indicators and important knowledge points of regression problems

Nunjuks template engine

备份阿里云实例-oss-browser
![Management by objectives [14 of management]](/img/7b/412d4865be8453af93f57e54ff991f.png)
Management by objectives [14 of management]
![[4500 word summary] a complete set of skills that a software testing engineer needs to master](/img/82/acae52928b3ab48e9ecbf4ec436e5e.jpg)
[4500 word summary] a complete set of skills that a software testing engineer needs to master

Discuss | what preparations should be made before ar application is launched?

Performance test process and plan

CVPR 2022丨学习用于小样本语义分割的非目标知识

Mobile app takeout ordering personal center page
随机推荐
pip相关命令
Skills of embedded C language program debugging and macro use
开发一个小程序商城需要多少钱?
Chapter 2 building CRM project development environment (building development environment)
Performance test process and plan
Main work of digital transformation
Chapter 3 business function development (to remember account and password)
Kubernetes DevOps CD工具对比选型
socket编程之常用api介绍与socket、select、poll、epoll高并发服务器模型代码实现
DataSimba推出微信小程序,DataNuza接受全场景考验? | StartDT Hackathon
Tips for this week 134: make_ Unique and private constructors
简单几步教你如何看k线图图解
Tear the Nacos source code by hand (tear the client source code first)
物联网OTA技术介绍
< code random recording two brushes> linked list
不能忽略的现货白银短线操作小技巧
Year SQL audit platform
Slider plug-in for swiper left and right switching
现货白银分析中的一些要点
Kirk Borne的本周学习资源精选【点击标题直接下载】