Cats and technology
Javascript
Physics and Animation
Why should this matter to me?
Breathe life into your application
Give users context
Creates the illusion of speed
What are the tools?
Canvas + WebGL
Canvas + Javascript
CSS
Javascript Libraries and Frameworks
Cascading Style sheets
Pros
Animate.css!
Cascading Style sheets
Pros
use translate() for hardware acceleration
Cascading Style sheets
Cons
.myAnimation {
-moz-animation-name: myAnimation;
-moz-animation-duration: 2000ms;
-moz-animation-delay: 0ms;
-moz-animation-fill-mode: forwards;
-moz-animation-timing-function: linear;
-ms-animation-name: myAnimation;
-ms-animation-duration: 2000ms;
-ms-animation-delay: 0ms;
-ms-animation-fill-mode: forwards;
-ms-animation-timing-function: linear;
-o-animation-name: myAnimation;
-o-animation-duration: 2000ms;
-o-animation-delay: 0ms;
-o-animation-fill-mode: forwards;
-o-animation-timing-function: linear;
-webkit-animation-name: myAnimation;
-webkit-animation-duration: 2000ms;
-webkit-animation-delay: 0ms;
-webkit-animation-fill-mode: forwards;
-webkit-animation-timing-function: linear;
animation-name: myAnimation;
animation-duration: 2000ms;
animation-delay: 0ms;
animation-fill-mode: forwards;
animation-timing-function: linear;
}Prefixes...
Cascading Style sheets
Cons
Cross Browser Implementation differences
Can't perform complex or multilayered operations
Javascript
Canvas + Javascript = More Complex animations
how is this possible?
setInterval(function() {
// animiate something
}, 1000/60);setInterval???
how is this possible?
function repeatOften() {
// Do whatever
requestAnimationFrame(repeatOften);
}
requestAnimationFrame(repeatOften);requestAnimationFrame
Call it once to kick it off, then it recursively calls itself!
Performance issues?
javascript
transform3d and matrix3d trigger the gpu
Web Graphics Library
Javascript Libraries are optimized to work around the DOM
...how!?
Demos (famo.us)
Demos (famo.us)
Demos (greensock)
Demos (webgl)
ui/ux resources
Animations and Physics
By William Gottschalk
Animations and Physics
- 549