GSAP KeyFrames
gsap.to(".box", {
keyframes: {
x: [0, 100, 100, 0, 0],
y: [0, 0, 100, 100, 0],
ease: "power1.inOut"
},
duration: 2
});
//-------
gsap.to(".elem", {
keyframes: [
{x: 100, duration: 1, ease: 'sine.out'}, // finetune with individual eases
{y: 200, duration: 1, delay: 0.5}, // create a 0.5 second gap
{rotation: 360, duration: 2, delay: -0.25} // overlap by 0.25 seconds
],
ease: 'expo.inOut' // ease the entire keyframe block
});
// ------
gsap.to(".elem", {
keyframes: {
"0%": { x: 100, y: 100},
"75%": { x: 0, y: 0, ease: 'sine.out'}, // finetune with individual eases
"100%": { x: 50, y: 50 },
easeEach: 'expo.inOut' // ease between keyframes
},
ease: 'none' // ease the entire keyframe block
duration: 2,
})
// https://greensock.com/understanding-keyframes/
Distinct Dingo