当前位置:网站首页>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
边栏推荐
猜你喜欢
Kirk Borne的本周学习资源精选【点击标题直接下载】
Classification of regression tests
debian10系统问题总结
Save the memory of the model! Meta & UC Berkeley proposed memvit. The modeling time support is 30 times longer than the existing model, and the calculation amount is only increased by 4.5%
嵌入式C语言程序调试和宏使用的技巧
小程序中实现付款功能
Year SQL audit platform
Debian10 compile and install MySQL
Simple configuration of single arm routing and layer 3 switching
Idea completely uninstalls installation and configuration notes
随机推荐
直播软件搭建,canvas文字加粗
[principle and technology of network attack and Defense] Chapter 1: Introduction
Yearning-SQL审核平台
Year SQL audit platform
卖空、加印、保库存,东方甄选居然一个月在抖音卖了266万单书
[paper sharing] where's crypto?
[论文分享] Where’s Crypto?
Afghan interim government security forces launched military operations against a hideout of the extremist organization "Islamic state"
Tips for this week 134: make_ Unique and private constructors
Nunjuks template engine
Performance test process and plan
小程序中实现付款功能
『HarmonyOS』DevEco的下载安装与开发环境搭建
What is the general yield of financial products in 2022?
【剑指 Offer】59 - I. 滑动窗口的最大值
[C language] string function
通过 Play Integrity API 的 nonce 字段提高应用安全性
Tips of this week 135: test the contract instead of implementation
Chapter 3 business function development (safe exit)
科学家首次观察到“电子漩涡” 有助于设计出更高效的电子产品