Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Super Smooth Animations
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Giacomo "Giko" Zinetti
March 16, 2018
Programming
1
100
Super Smooth Animations
Speech for CSSDay in Faenza (Italy)
March, 16th 2018
Live on
https://cssday2018.slides.giko.it/
Giacomo "Giko" Zinetti
March 16, 2018
Tweet
Share
More Decks by Giacomo "Giko" Zinetti
See All by Giacomo "Giko" Zinetti
Cmd Alt I - Chrome Dev tools
gcmznt
0
76
ES2015 new features
gcmznt
0
54
CSS from the future
gcmznt
0
38
Web performance & Http2
gcmznt
0
59
CSS variables
gcmznt
2
110
CSS Performance
gcmznt
2
82
Other Decks in Programming
See All in Programming
エージェント開発初心者の僕がエージェントを作った話と今後やりたいこと
thasu0123
0
250
野球解説AI Agentを開発してみた - 2026/02/27 LayerX社内LT会資料
shinyorke
PRO
0
320
AIとペアプロして処理時間を97%削減した話 #pyconshizu
kashewnuts
1
240
Angular-Apps smarter machen mit Gen AI: Lokal und offlinefähig - Hands-on Workshop!
christianliebel
PRO
0
120
The Ralph Wiggum Loop: First Principles of Autonomous Development
sembayui
0
3.7k
どんと来い、データベース信頼性エンジニアリング / Introduction to DBRE
nnaka2992
1
290
オブザーバビリティ駆動開発って実際どうなの?
yohfee
3
860
GC言語のWasm化とComponent Modelサポートの実践と課題 - Scalaの場合
tanishiking
0
110
Go Conference mini in Sendai 2026 : Goに新機能を提案し実装されるまでのフロー徹底解説
yamatoya
0
600
Goの型安全性で実現する複数プロダクトの権限管理
ishikawa_pro
2
360
PostgreSQL を使った快適な go test 環境を求めて
otakakot
0
560
GoのDB アクセスにおける 「型安全」と「柔軟性」の両立 - Bob という選択肢
tak848
0
110
Featured
See All Featured
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
Code Reviewing Like a Champion
maltzj
528
40k
Heart Work Chapter 1 - Part 1
lfama
PRO
5
35k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.2k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.8k
How STYLIGHT went responsive
nonsquared
100
6k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
140
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.2k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
63
51k
Reality Check: Gamification 10 Years Later
codingconduct
0
2k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.4k
Transcript
Super smooth animations
Expectation Expectation
Reality Reality
Battery drain Battery drain
Device Device overheating overheating
Maillard Maillard
Giacomo Zinetti Giacomo Zinetti @gcmznt @gcmznt
How browser How browser renders? renders?
Render Render cycle cycle JavaScript JavaScript Style Style Layout Layout
Paint Paint Composite Composite
Our logic Our logic JavaScript JavaScript Style Style Layout Layout
Paint Paint Composite Composite
margin margin padding padding Reflow Reflow JavaScript JavaScript Style Style
Layout Layout Paint Paint Composite Composite
color color background background Repaint Repaint JavaScript JavaScript Style Style
Layout Layout Paint Paint Composite Composite
transform transform opacity opacity Compose Compose JavaScript JavaScript Style Style
Layout Layout Paint Paint Composite Composite
CSS CSS
Animate Animate compositor-only compositor-only properties properties
Execute long JS task Start heavy JS loop Left Translate
Create layers Create layers will-change will-change
❌ ❌ * { * { will-change: transform; will-change: transform;
} }
Disable hover Disable hover on scroll on scroll
JS JS
Avoid forced Avoid forced synchronous synchronous layout layout
❌ ❌ elements.forEach(el => { elements.forEach(el => { el.querySelector('img').style.width el.querySelector('img').style.width
= `${el.offsetWidth}px`; = `${el.offsetWidth}px`; }) })
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`; }) })
rAF rAF requestAnimationFrame() requestAnimationFrame()
rIC rIC requestIdleCallback() requestIdleCallback()
Split big tasks Split big tasks
Web workers Web workers
TARGET TARGET RAIL RAIL
Response <100ms Response <100ms Animation <16ms Animation <16ms Idle <50ms
Idle <50ms Load <1000ms Load <1000ms
FLIP FLIP by @aerotwist by @aerotwist
First First const first = const first = el.getBoundingClientRect(); el.getBoundingClientRect();
Last Last el.classList.toggle('end'); el.classList.toggle('end'); const last = const last =
el.getBoundingClientRect(); el.getBoundingClientRect();
Invert Invert const invert = const invert = first.height /
last.height; first.height / last.height;
Play Play el.animate([ el.animate([ { transform: `scale(${invert}px)` }, { transform:
`scale(${invert}px)` }, { transform: 'scale(0)' } { transform: 'scale(0)' } ], 300); ], 300);
First First Last Last Invert Invert Play Play
None
Content Content VS VS Animations Animations
Users! Users!
The best animation The best animation is the invisible one
is the invisible one Thank you Thank you
Links Links This slides Codepen examples Feedbacks are welcome! Web
Fundamentals: Performance CSS Triggers FLIP by @aerotwist