当前位置:网站首页>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
是开始时候做的一个回调函数
边栏推荐
- debian10系统问题总结
- Easy to understand [linear regression of machine learning]
- Chapter 3 business function development (user login)
- SQLite SQL exception near "with": syntax error
- 【蓝桥杯集训100题】scratch从小到大排序 蓝桥杯scratch比赛专项预测编程题 集训模拟练习题第17题
- [论文分享] Where’s Crypto?
- 上市十天就下线过万台,欧尚Z6产品实力备受点赞
- 小试牛刀之NunJucks模板引擎
- [OKR target management] case analysis
- Mui side navigation anchor positioning JS special effect
猜你喜欢
持续测试(CT)实战经验分享
小试牛刀之NunJucks模板引擎
Kubernetes DevOps CD工具对比选型
数学分析_笔记_第11章:Fourier级数
Some key points in the analysis of spot Silver
Kirk Borne的本周学习资源精选【点击标题直接下载】
上市十天就下线过万台,欧尚Z6产品实力备受点赞
A few simple steps to teach you how to see the K-line diagram
物联网OTA技术介绍
Datasimba launched wechat applet, and datanuza accepted the test of the whole scene| StartDT Hackathon
随机推荐
PHP面试题 foreach($arr as &$value)与foreach($arr as $value)的用法
[paper sharing] where's crypto?
Unlike the relatively short-lived industrial chain of consumer Internet, the industrial chain of industrial Internet is quite long
Chapter 2 build CRM project development environment (database design)
go语言的字符串类型、常量类型和容器类型
讨论| 坦白局,工业 AR 应用为什么难落地?
物联网OTA技术介绍
数学分析_笔记_第11章:Fourier级数
SD_DATA_SEND_SHIFT_REGISTER
[principle and technology of network attack and Defense] Chapter 1: Introduction
Introduction de l'API commune de programmation de socket et mise en œuvre de socket, select, Poll et epoll
Tear the Nacos source code by hand (tear the client source code first)
Debian10 compile and install MySQL
Tips for this week 134: make_ Unique and private constructors
Management by objectives [14 of management]
Tips for this week 131: special member functions and ` = Default`
Tips of the week 136: unordered containers
Machine vision (1) - Overview
Native JS verification code
小程序中实现付款功能