Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Super Smooth Animations

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.

Super Smooth Animations

Speech for CSSDay in Faenza (Italy)
March, 16th 2018

Live on https://cssday2018.slides.giko.it/

Avatar for Giacomo "Giko" Zinetti

Giacomo "Giko" Zinetti

March 16, 2018
Tweet

More Decks by Giacomo "Giko" Zinetti

Other Decks in Programming

Transcript

  1. elements.forEach((el, i) => { elements.forEach((el, i) => { ws[i] =

    el.offsetWidth; ws[i] = el.offsetWidth; }) }) elements.forEach((el, i) => { elements.forEach((el, i) => { el.querySelector('img').style.width el.querySelector('img').style.width = `${ws[i]}px`; = `${ws[i]}px`; }) })
  2. Invert Invert const invert = const invert = first.height /

    last.height; first.height / last.height;
  3. Play Play el.animate([ el.animate([ { transform: `scale(${invert}px)` }, { transform:

    `scale(${invert}px)` }, { transform: 'scale(0)' } { transform: 'scale(0)' } ], 300); ], 300);
  4. The best animation The best animation is the invisible one

    is the invisible one Thank you Thank you
  5. Links Links This slides Codepen examples Feedbacks are welcome! Web

    Fundamentals: Performance CSS Triggers FLIP by @aerotwist