当前位置:网站首页>GSAP animation library
GSAP animation library
2022-07-07 18:38:00 【Vegetable bird learning code··】
gsap Animation library
First, import. gsap Animation library
npm i gsap -S
After installation, reference in the projectimport gsap from "gsap"
Normal page usage
gsap.to(' Class name ',{
Animation properties })
// We can also use timeline to write animation
// Create a timeline , Then use chain grammar , Students who have done video clips may understand better
var tl = gsap.timeline();
tl.to(".box1", {
rotation: 27, x: 100, duration: 10 }).to(".box1", {
rotation: 27, x: 100, duration: 10 });
THREE Use of interface
//cube Is instantiated 3d goods gsap.to The reaction is the result of the object
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(' Here we go ');
}
})
// Double click screen monitor
window.addEventListener('dblclick', () => {
console.log(ani.isActive());// Whether it is in motion
if (ani.isActive()) {
ani.pause() // Animation stops
} else {
ani.resume()// Animation recovery
}
})
ease
It's speedrepeat
Repeat the number -1 Infinite loopyoyo
Back and forth movementdelay
Delayed motiononComplete
It is a callback function done when it is finishedonStart
It is a callback function done at the beginning
边栏推荐
- 现货白银分析中的一些要点
- Debian10 compile and install MySQL
- gsap动画库
- 你真的理解粘包与半包吗?3分钟搞懂它
- Tips for this week 134: make_ Unique and private constructors
- 线程池和单例模式以及文件操作
- 标准ACL与扩展ACL
- [trusted computing] Lesson 12: TPM authorization and conversation
- [PaddleSeg源码阅读] PaddleSeg Validation 中添加 Boundary IoU的计算(1)——val.py文件细节提示
- Discuss | frankly, why is it difficult to implement industrial AR applications?
猜你喜欢
Nunjuks template engine
行业案例|数字化经营底座助力寿险行业转型
AI 击败了人类,设计了更好的经济机制
[paddleseg source code reading] add boundary IOU calculation in paddleseg validation (1) -- val.py file details tips
AntiSamy:防 XSS 攻击的一种解决方案使用教程
Interviewer: why is the page too laggy and how to solve it? [test interview question sharing]
简单几步教你如何看k线图图解
Chapter 2 building CRM project development environment (building development environment)
String type, constant type and container type of go language
ICer知识点杂烩(后附大量题目,持续更新中)
随机推荐
Afghan interim government security forces launched military operations against a hideout of the extremist organization "Islamic state"
Live broadcast software construction, canvas Text Bold
【C语言】字符串函数
nest. Database for getting started with JS
科学家首次观察到“电子漩涡” 有助于设计出更高效的电子产品
Ten thousand words nanny level long article -- offline installation guide for datahub of LinkedIn metadata management platform
Automated testing: a practical skill that everyone wants to know about robot framework
ICer知识点杂烩(后附大量题目,持续更新中)
保证接口数据安全的10种方案
SD_DATA_RECEIVE_SHIFT_REGISTER
单臂路由和三层交换的简单配置
The report of the state of world food security and nutrition was released: the number of hungry people in the world increased to 828million in 2021
静态路由配置
简单几步教你如何看k线图图解
Chapter 3 business function development (to remember account and password)
How to clean when win11 C disk is full? Win11 method of cleaning C disk
Tips of this week 141: pay attention to implicit conversion to bool
【蓝桥杯集训100题】scratch从小到大排序 蓝桥杯scratch比赛专项预测编程题 集训模拟练习题第17题
RIP和OSPF的区别和配置命令
[principle and technology of network attack and Defense] Chapter 6: Trojan horse