KEMBAR78
CSS Transitions, Transforms, Animations | PPTX
CSS Transitions, Transforms & AnimationsTuesday February 23, 2011
transitions
Ch-ch-ch-ch-changesClass .aarrow === css3 transition == ZOMGClass .b
What (are CSS3 transitions)?Sometimes we change CSS properties dynamically bychanging or adding a class.e.g. $(‘input’).addClass(‘error’);CSS3 Transitions allow us to animate the change in these CSS properties… easily!
Transitions defined & browser support-browser-transition: {property} {duration} {easing} {delay};easing defaults: linear, ease-in, ease-out, ease-in-out-webkit-transition: (Safari 3.1+, Chrome since forever)-moz-transition: (FF 4+)-o-transition: (Opera 10.doYouCare) -msie-transition: (apparently NOT ie9 )
animations
from {left: 100px;width: 100px;height: 100px;animation-timing: ease-in;}to {left: 200px;width: 50px;height: 50px;}keyframesbut what’s going on in the middle?changing multiple styles at different times over an interval7
keyframes (cont.)from {...}to {transform: rotate(180deg);left: 200px;}60% {left: 100px;}30% {left: 200px;width: 50px;height: 50px;}8
using animations programmatically InitializerinitAnimationEvent - Initializes an animation event given a DOMobject
typeArg (string)
canBubbleArg (boolean)
cancelableArg (boolean)
animationNameArg (string)
elapsedTimeArg (float)CallbacksanimationStart
animationEnd
animationIteration9
optionsanimation-delay: 5s;delay to startanimation-direction: alternate; animation is played in reverse on odd iterationsanimation-durations: 5s;time to complete animationanimation-iteration-count: 5;times to play animation (doubled for alternate)animation-name: myAnimation;unique ID for animationanimation-play-state: paused;pauses/plays the animationanimation-timing-function: cubic-bezier(x1,y1,x2,y2)a custom/predefined timing curve to follow10
GPU vs. CPUhardware accelerationIt’s the difference between...GPU’s are very good BitBLIT Operations11
Animation Buildersdevelopers don’t want to code animationsBanner AdsPurely Native Web AppsNative-Like InterfacesImmersive Sites(Sencha Animator)into the mainstream12
examplesOSX Dock
404 Page
Solar System
Portfolio13
transforms
transform: rotate(x)rotate(45deg)rotate(180deg)rotate(0deg)
transform: scale(x)scale(2)scale(1)
transform: translate(x, y)translate(0,0)translate(200px, 100px)
transform: skew(x, y)skewX(25deg)skewY(25deg)skew(0deg, 0deg)
transform: skew(x, y)25°25°skewX(25deg)skewY(25deg)skew(0deg, 0deg)
transform: skew(x, y)skew(25deg, 25deg)skew(0deg, 0deg)
transform: matrix(a,b,c,d,e,f)???
transform: matrix(a,b,c,d,e,f)a   cebdf0   0   1=matrix(a,b,c,d,e,f)3x3 matrix
transform: matrix(a,b,c,d,e,f)1   0   00   1   00   0   1=matrix(1,0,0,1,0,0)3x3 matrix
transform: matrix(a,b,c,d,e,f)2   0   00   2   00   0   1=matrix(2,0,0,2,0,0)3x3 matrix

CSS Transitions, Transforms, Animations