当前位置:网站首页>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
是开始时候做的一个回调函数
边栏推荐
- DataSimba推出微信小程序,DataNuza接受全场景考验? | StartDT Hackathon
- 海量数据去重的hash,bitmap与布隆过滤器Bloom Filter
- [paper sharing] where's crypto?
- 用存储过程、定时器、触发器来解决数据分析问题
- Live broadcast software construction, canvas Text Bold
- nest. Database for getting started with JS
- idea彻底卸载安装及配置笔记
- [4500 word summary] a complete set of skills that a software testing engineer needs to master
- SD_DATA_RECEIVE_SHIFT_REGISTER
- Chapter 3 business function development (to remember account and password)
猜你喜欢
Kirk Borne的本周学习资源精选【点击标题直接下载】
Learn to make dynamic line chart in 3 minutes!
上市十天就下线过万台,欧尚Z6产品实力备受点赞
Interviewer: why is the page too laggy and how to solve it? [test interview question sharing]
Yearning-SQL审核平台
Nunjuks template engine
List selection JS effect with animation
The highest level of anonymity in C language
[principle and technology of network attack and Defense] Chapter 6: Trojan horse
A few simple steps to teach you how to see the K-line diagram
随机推荐
AntiSamy:防 XSS 攻击的一种解决方案使用教程
Debian10 compile and install MySQL
云安全日报220707:思科Expressway系列和网真视频通信服务器发现远程攻击漏洞,需要尽快升级
How to clean when win11 C disk is full? Win11 method of cleaning C disk
Mui side navigation anchor positioning JS special effect
Skills of embedded C language program debugging and macro use
debian10系统问题总结
小程序中实现付款功能
Download, installation and development environment construction of "harmonyos" deveco
debian10编译安装mysql
Interviewer: why is the page too laggy and how to solve it? [test interview question sharing]
Introduction to OTA technology of Internet of things
手撕Nacos源码(先撕客户端源码)
Yearning-SQL审核平台
Chapter 3 business function development (user access project)
The highest level of anonymity in C language
Sanxian Guidong JS game source code
现货白银分析中的一些要点
[PaddleSeg源码阅读] PaddleSeg Validation 中添加 Boundary IoU的计算(1)——val.py文件细节提示
SD_DATA_RECEIVE_SHIFT_REGISTER