Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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/
Comment

PREVIOUS NEXT
Code Example
Javascript :: fs renameSync 
Javascript :: mongoose add document 
Javascript :: javascript get elements by multiple class names 
Javascript :: change element text innerhtml keeping the elements or tags inside 
Javascript :: slice() in javascript 
Javascript :: Error: [Home] is not a <Route component. All component children of <Routes must be a <Route or <React.Fragment 
Javascript :: exponent javascript 
Javascript :: sort array ij js 
Javascript :: quitar checked jquery 
Javascript :: servicenow gliderecord lookup 
Javascript :: lexical environment in javascript 
Javascript :: destructuring 
Javascript :: Google App Script getSheetByName 
Javascript :: sequelize update index column 
Javascript :: The toUpperCase JavaScript string method 
Javascript :: not equal to in js 
Javascript :: audio customization 
Javascript :: expressjs param 
Javascript :: brain.js 
Javascript :: jest mock jwt-decode 
Javascript :: useref react class component 
Javascript :: copy svg to clipboard javascript 
Javascript :: javascript sort two-dimensional array by column 
Javascript :: javascript url 
Javascript :: puppeteer click element with custom property 
Javascript :: javascript dom manipulation 
Javascript :: slice array of objects javascript 
Javascript :: ion change ionic angular 
Javascript :: isodate mongodb nodejs 
Javascript :: filter array js 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =