SlideShare a Scribd company logo
FASTEST CSS3
ANIMATIONS
Berkay Beyaz - @berkaybeyaz6
WHO AM I ?
• At 17
• Entrepreneur @Splashup - http://splashup.in
• Backend Developer
WHY ANIMATE ?
• Delightful user experience
• Hiding possible loading times
• For attract attention
SCROLLING
UNPLEASANT UX DELIGHTFUL UX
jQuery way
400px
CSS
.Component {
width: 100px;
height: 100px;
background: red;
position: absolute;
top: 0;
left: 0;
}
HTML
<div class=“Component”></div>
JS
$(“.Component”).animate({left: 400}, {duration: 200});
HOW IT WORKS ANIMATE ON JQUERY ?
Css3 fallback requestAnimationFrame()
setInterval()
Dom Manipulation
THAT'S ALL
RIGHT ?
NOT LIKE THAT
WHAT WE DO
NOW ?
Fastest css3 animations
VELOCITY.JS
• Velocity is an animation engine
• jQuery, it uses its own animation stack that delivers its performance through two
underlying principles
• It works with and without jQuery. It’s faster than jQuery
jQuery
jQuery
animation
partials.
Velocity.js
Fastest css3 animations
VELOCITY SCHEME
Sync. DOM
tween stack to
minimize Layout
Trashing
(Recalculate Style)
cache values to
minimize DOM
querying
Fastest css3 animations
BROWSER SUPPORT
PROGRESSIVE ENHANCEMENT
Old Browsers
+ Basic functionality
- UI transitions
Old Browsers
+ Basic functionality
+ UI transitions
TESTING ON BROWSERS
RESULTS
SOLUTION ?
AUTOPREFIXER
• Add the desired vendor prefixes and remove unnecessary in your CSS
• Violates D.R.Y. principle
• Compatible with all browsers
• Using with Grunt
http://bitly.com/2ejNcjs
AUTOPREFIXER
.myComponent {
transform: translateX(0);
}
.myComponent{
-webkit-transform: translateX(0);
-ms-transform: translateX(0);
transform: translateX(0);
}
CSSGENERATEDCSS
Tutorial : http://bit.ly/1SWtDdz
Basic
Animations
1. CSS3 TRANSITIONSCSS
.Component {
width: 100px;
height: 100px;
background: red;
-webkit-transition: width 2s;
transition: width 2s;
}
.Component:hover {
width: 300px;
}
2. CSS3 Transforms
CSS3 TRANSFORMS
Rotate Scale Translate
Allow us to visually manipulate elements (2D & 3D)
IDENTIFYING THE BOTTLENECK
TOP/LEFT
• Might affect the layout
• Recalculates style
TRANSLATE
• Does not affect the
element’s neighbors
• Does not recalculate style
Suitable for layout Suitable for animations
EXAMPLE CODE
#box{
transition: 200ms;
}
.animate-it{
}
CSS
transform: translateX(400px);left: 400px;
lefttransform
3. HARDWARE ACCELERATION
HOW IT WORKS ?
Compute - Intensive
Functions Sequential
CPU Code
MULTIPLE
CORES
HUNDREDS
OF CORES
APPLICATION CODE
GPU
COMPUTE INTENSIVE FUNCTIONS
• 3D animations: translate3d(5px, 5px, 5px);
• What about 2D animations?
• translateX(400px) == translate3d(400px, 0, 0)
• transform: translateX(400px) translateZ(0);
FORCING HARDWARE ACCELERATION
#box{
transition: transform 200ms;
}
.animate-it{
transform:
}
CSS
translateX(400px);translate3d(400px, 0, 0);
4 THINGS A BROWSER CAN ANIMATE
CHEAPLY
Position : transform: translate(x, y)
Scale :
Rotation :
Opacity :
transform: scale(n)
transform: rotate(deg)
opacity: 0...1
PROFILING
PROFILING
• Computer display refresh rate: 60Hz
• At 60hz: 16ms to prepare for the next frame
• Chrome Dev tools: Timeline
• Identify possible bottlenecks
• Lag begins to show at: 30Hz
CONSEQUENTLY
Web Animation Translate/Scale 300 Dots – 98.9FPS
jQuery 3 Animation 300 Dots – 21.5FPS
https://www.greensock.com/js/speed.html
CHOOSE IT !
BRIEF
• Don’t animate using jQuery
• Use autoprefixer or a similar tool
• Use Top & Left for the layout only
• Move elements using translateX & translateY
• Use hardware acceleration (responsibly)
• Don’t Guess It, Profile It!
• Make CSS3 transitions part of your coding habits
THANK YOU
@berkaybeyaz1
@berkaybeyaz6
.in
QUESTIONS ?

More Related Content

PPTX
CSS Animations & Transitions
PDF
Serious Animation (an introduction to Web Animations)
PDF
Animations on Fire - Making Web animations fast
PPT
PDF
Famo.us introduction
PDF
Demystifying Angular Animations
PDF
Famous-il kick-off presentation
CSS Animations & Transitions
Serious Animation (an introduction to Web Animations)
Animations on Fire - Making Web animations fast
Famo.us introduction
Demystifying Angular Animations
Famous-il kick-off presentation

What's hot (20)

PDF
Dynamic CSS: Transforms, Transitions, and Animation Basics
KEY
CSS3: Ready for Primetime?
PDF
Awesome html with ujs, jQuery and coffeescript
PDF
Minimalism in Web Development
PDF
WordPressサイトに簡単に支払い機能をつけようとした時に考えたこと
&調べたこと
+やってみた JP Stripes Kyoto vol.3
PDF
Diving into the deep end: SVG, Angular and Accessibility
PDF
Simplify your CSS with Stylus and Nib
PDF
Build tons of multi-device JavaScript applications - Part 2 : (black) Magic S...
PDF
Make Your Animations Perform Well - JS Conf Budapest 2017
PDF
Beutiful javascript with coffeescript
PDF
SDEC12 Beautiful javascript with coffeescript
KEY
Getting Started with CoreGraphics
PDF
Starting Core Animation
KEY
The Future of HTML Motion Design
PPSX
C# Powershell and an Azure Function Walk Into a Bar...
PDF
Xamarin 9/10 San Diego Meetup
PDF
Build tons of multi-device JavaScript applications - Part 1 : Boilerplate, de...
PDF
Canvas & Canvas - Presentation to NYC.js
PDF
Running HTML5 Mobile Web Games at 60fps
PPTX
CSS3 Animations & Transitions with PhoneGap
Dynamic CSS: Transforms, Transitions, and Animation Basics
CSS3: Ready for Primetime?
Awesome html with ujs, jQuery and coffeescript
Minimalism in Web Development
WordPressサイトに簡単に支払い機能をつけようとした時に考えたこと
&調べたこと
+やってみた JP Stripes Kyoto vol.3
Diving into the deep end: SVG, Angular and Accessibility
Simplify your CSS with Stylus and Nib
Build tons of multi-device JavaScript applications - Part 2 : (black) Magic S...
Make Your Animations Perform Well - JS Conf Budapest 2017
Beutiful javascript with coffeescript
SDEC12 Beautiful javascript with coffeescript
Getting Started with CoreGraphics
Starting Core Animation
The Future of HTML Motion Design
C# Powershell and an Azure Function Walk Into a Bar...
Xamarin 9/10 San Diego Meetup
Build tons of multi-device JavaScript applications - Part 1 : Boilerplate, de...
Canvas & Canvas - Presentation to NYC.js
Running HTML5 Mobile Web Games at 60fps
CSS3 Animations & Transitions with PhoneGap
Ad

Viewers also liked (16)

KEY
HTML5で作るスマホブラウザゲーム
PDF
JavaScript + CSS3を活用して スマートフォンサイト/アプリに 動きを付けてみよう
PDF
Designing Motion - FITC TO
PPTX
CSS3 Animation and Artful Storytelling: Adding Value to Children’s Ebooks - e...
PDF
the rabbit and the tortoise
PDF
CSS3 Transforms Transitions and Animations
PPTX
Css3 animation
PDF
The Future State of Layout
PDF
Creating Beautiful CSS3 Animations - FITC Amsterdam 2016
PPTX
今こそCSS 今こそfor you
PPT
Experience Themes: An Element of Story Applied to Design
PDF
CSS3 secrets: 10 things you might not know about CSS3
ODP
Presentation laravel 5 4
PDF
Performance: Beyond Your Portfolio
PDF
How to Extend Axure's Animation Capability
PDF
Laracon Online: Grid and Flexbox
HTML5で作るスマホブラウザゲーム
JavaScript + CSS3を活用して スマートフォンサイト/アプリに 動きを付けてみよう
Designing Motion - FITC TO
CSS3 Animation and Artful Storytelling: Adding Value to Children’s Ebooks - e...
the rabbit and the tortoise
CSS3 Transforms Transitions and Animations
Css3 animation
The Future State of Layout
Creating Beautiful CSS3 Animations - FITC Amsterdam 2016
今こそCSS 今こそfor you
Experience Themes: An Element of Story Applied to Design
CSS3 secrets: 10 things you might not know about CSS3
Presentation laravel 5 4
Performance: Beyond Your Portfolio
How to Extend Axure's Animation Capability
Laracon Online: Grid and Flexbox
Ad

Similar to Fastest css3 animations (20)

PDF
Choosing your animation adventure - Generate NYC 2018
PDF
Css3 transitions and animations + graceful degradation with jQuery
KEY
CSS and CSS3
PPTX
About Best friends - HTML, CSS and JS
KEY
A brief look at CSS3 techniques by Aaron Rodgers, Web Designer @ vzaar.com
PDF
Practical tipsmakemobilefaster oscon2016
KEY
HTML5, CSS3, and other fancy buzzwords
PDF
JavaONE 2012 Using Java with HTML5 and CSS3
PDF
Smooth Animations for Web & Hybrid
PPTX
Css animation
PDF
Choosing your animation adventure - Ffronteers Conf 2017
PPTX
PG Day Us: Animations for Web & Hybrid
PDF
Make your animations perform well - Anna Migas - Codemotion Rome 2017
PDF
I Can't Believe It's Not Flash
PDF
Make your animations perform well
PDF
UIWebViewでつくるUI
KEY
Rockstar Graphics with HTML5
PPTX
Rich and Beautiful: Making Attractive Apps in HTML5 [Wpg 2013]
PDF
Hi performance table views with QuartzCore and CoreText
ZIP
Rails in the Cloud
Choosing your animation adventure - Generate NYC 2018
Css3 transitions and animations + graceful degradation with jQuery
CSS and CSS3
About Best friends - HTML, CSS and JS
A brief look at CSS3 techniques by Aaron Rodgers, Web Designer @ vzaar.com
Practical tipsmakemobilefaster oscon2016
HTML5, CSS3, and other fancy buzzwords
JavaONE 2012 Using Java with HTML5 and CSS3
Smooth Animations for Web & Hybrid
Css animation
Choosing your animation adventure - Ffronteers Conf 2017
PG Day Us: Animations for Web & Hybrid
Make your animations perform well - Anna Migas - Codemotion Rome 2017
I Can't Believe It's Not Flash
Make your animations perform well
UIWebViewでつくるUI
Rockstar Graphics with HTML5
Rich and Beautiful: Making Attractive Apps in HTML5 [Wpg 2013]
Hi performance table views with QuartzCore and CoreText
Rails in the Cloud

Recently uploaded (20)

PPTX
innovation process that make everything different.pptx
PDF
💰 𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓 💰
PDF
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
DOCX
Unit-3 cyber security network security of internet system
PPTX
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
PDF
Sims 4 Historia para lo sims 4 para jugar
PPTX
E -tech empowerment technologies PowerPoint
PPT
Design_with_Watersergyerge45hrbgre4top (1).ppt
PDF
An introduction to the IFRS (ISSB) Stndards.pdf
PDF
RPKI Status Update, presented by Makito Lay at IDNOG 10
PDF
WebRTC in SignalWire - troubleshooting media negotiation
PPTX
PptxGenJS_Demo_Chart_20250317130215833.pptx
PPTX
Power Point - Lesson 3_2.pptx grad school presentation
PPTX
introduction about ICD -10 & ICD-11 ppt.pptx
PDF
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
PPTX
522797556-Unit-2-Temperature-measurement-1-1.pptx
PPTX
SAP Ariba Sourcing PPT for learning material
PDF
Decoding a Decade: 10 Years of Applied CTI Discipline
PDF
How to Ensure Data Integrity During Shopify Migration_ Best Practices for Sec...
PPTX
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
innovation process that make everything different.pptx
💰 𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓 💰
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
Unit-3 cyber security network security of internet system
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
Sims 4 Historia para lo sims 4 para jugar
E -tech empowerment technologies PowerPoint
Design_with_Watersergyerge45hrbgre4top (1).ppt
An introduction to the IFRS (ISSB) Stndards.pdf
RPKI Status Update, presented by Makito Lay at IDNOG 10
WebRTC in SignalWire - troubleshooting media negotiation
PptxGenJS_Demo_Chart_20250317130215833.pptx
Power Point - Lesson 3_2.pptx grad school presentation
introduction about ICD -10 & ICD-11 ppt.pptx
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
522797556-Unit-2-Temperature-measurement-1-1.pptx
SAP Ariba Sourcing PPT for learning material
Decoding a Decade: 10 Years of Applied CTI Discipline
How to Ensure Data Integrity During Shopify Migration_ Best Practices for Sec...
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx

Fastest css3 animations