a { color: green; } a:hover { color: orange; }
Hover Over Me
a { color: green; } a:hover { color: orange; }
Hover Over Me
a { color: red; transition: 1s; } a:hover { color: yellow; }
Hover Over Me
Enables the transition of properties from one state to the next over a defined length of time
code { color: black; font-size: 85%; background-color: rgba(255,255,255,0.9); transition: all 2s ease-in 50ms; } code:hover { color: red; font-size: 120%; background-color: rgba(255,255,255,0.8); }
code { transition: color, font-size, background-color 2s ease-in 50ms; }
code { color: black; font-size: 85%; background-color: rgba(255,255,255,0.9); transition: all 2s ease-in 50ms; } code:hover { color: red; transform: scale(1.4); transform-origin: 0 0; background-color: rgba(255,255,255,0.8); }
code { transition: transform 2s ease-in 50ms; }
Anything that has intermediate values
code { opacity: 1; } code:halfway { opacity: 0.5; } code:hover { opacity: 0; }
code { display: block; } code:halfway { display: ??? } code:hover { display: none; }
2 values that have REAL intermediary values
code { font-size: 100%; } code:halfway { font-size: 110%; } code:hover { font-size: 120%; }
code { height: auto; } code:halfway { height: ??? } code:hover { height: 1000px; }
.pencil { transition: all 1s ease-in 50ms; transform-origin: 100px 123px; } .pencil:hover { transform: rotate(360deg) scale(2); }
nav ul li { list-style-type: none; } nav > ul > li { display: inline-block; position:relative; } nav ul ul { transform: scale(1,0); transform-origin: top center; transition:0.2s linear 50ms; position:absolute; top: 100%; } nav li:hover ul { transform: scale(1,1); }
.card { position: absolute; perspective: 600px; } .card:hover { transition: 1s ease; } .card .front { transform: rotateX(0deg) rotateY(0deg); transform-style: preserve-3d; backface-visibility: hidden; transition: all .4s ease-in-out; } .card:hover .front { transform: rotateY(180deg); } .card .back { transform: rotateY(-180deg); transform-style: preserve-3d; backface-visibility: hidden; transition: all .4s ease-in-out; } .card:hover .back { transform: rotateY(0); } .card:first-of-type { transform: rotate(-5deg); } .card:nth-of-type(2):hover { transform: rotate(0) translatex(120px); } .card:last-of-type { transform: rotate(5deg); } .card:first-of-type:hover { transform: rotate(10deg) translatey(180px); }
|
|
|
|
|
Prefix <=38 | Prefix | 5/16 | Prefix <=26 | 10 |
Only need -webkit- vendor prefix. |
@keyframes ... @-webkit-keyframes ....
@keyframes clever_name_here ... @-webkit-keyframes clever_name_here ...
Don't use keyterms!
@keyframes slides { } @-webkit-keyframes slides { }
@keyframes writing { from { left: 0; } to { left: 100%; } }
@keyframes writing { 0% { left: 0; } 100% { left: 100%; } }
Don't forget the %
Don't quote the animation name
@keyframes writingWhileTired { 0% { left: 0; } 10% { left: 45%; } 90% { left: 55%; } 100% { left: 100%; } }
@keyframes W { 0% { left: 0; top: 0; } 25%, 75% { top: 400px; } 50% { top: 50px; } 100% { left: 80%; top: 0; } }
.pencil { width:100px; text-align: right; border-bottom: 10px solid; } .pencil::after { content: '✎'; position: absolute; bottom: -20px; right: -10px; }
@keyframes drawALine { 0%{ width:0; color:green; } 100% { width: 100%; color:blue; } }
.pencil {
animation-name: drawALine;
animation-duration: 3s;
}
-webkit- | reset
.pencil {
animation-name: drawALine;
animation-duration: 5s;
animation-timing-function: ease-in-out;
}
ease linear ease-in ease-out ease-in-out cubic-bezier(x1, y1, x2, y2) step-start /* same as steps(1, start) */ step-end /* same as steps(1, end) */ steps( X, start|end) /* X = # of steps + when change of value occurs */
-webkit- | reset
.pencil { ... animation-name: drawALine; animation-duration: 3s; animation-timing-function: ease-in-out; animation-iteration-count: 3; }
‘infinite’ or number. Default is ‘1’.
-webkit-animation-iteration-count: 3;
-webkit- | -moz- | -o-
.pencil {
animation-name: drawALine;
animation-duration: 8s;
animation-timing-function: ease-in-out;
animation-iteration-count: 2;
animation-delay: 2s;
}
-webkit- | reset
.pencil {
...
animation-name: drawALine;
animation-duration: 5s;
animation-timing-function: ease-in-out;
animation-iteration-count: 5;
animation-direction: normal
}
4 possible values: normal | alternate | reverse | alternate-reverse;
animation-direction: alternate;
-webkit- | reset
.pencil { animation-name: drawALine; animation-duration: 5s; animation-delay: 100ms; animation-timing-function: ease-in-out; animation-iteration-count: 5;animation-direction: normal;}
. . . can also be written as . . .
.pencil { animation: drawALine 5s ease-in-out 100ms 5; }
-webkit- | reset
.carda.flipped .front, .carda.unflipped .back { animation: flipme 1s linear forwards; } .carda.unflipped .front, .carda.flipped .back { animation: unflipme 1s linear both; } .card.flipped:nth-of-type(2){ transform: rotate(0) translatex(120px); } .carda.flipped:first-of-type{ transform: rotate(-5deg) translate(240px, 25px); } @keyframes flipme { 0% {transform: rotatey(0deg)} 100% {transform: rotateY(-180deg);} } @keyframes unflipme { 0% {transform: rotatey(180deg)} 100% {transform: rotateY(0deg);} }
values: none | forwards | backwards | both
.pencil {
animation-name: gettingThePencil;
animation-duration: 3s;
animation-timing-function: ease-in-out;
animation-iteration-count: 1;
animation-delay: 2s;
animation-fill-mode: none;
}
. . . or . . . -webkit- | reset
.pencil { animation: gettingThePencil 3s ease-in-out 1s forwards; }
.box { animation: showme 5s linear 5s 1;} @keyframes showme { 0% {left: 200px; background-color:blue;} 50% {background-color:green;} 100% {left: 600px; background-color: yellow;} }
animation-play-state: paused | running
.pencil { transform-origin: center 300px; animation: writingInCircles 3s linear infinite; } .pencil:hover { animation-play-state:paused; }
@keyframes writingInCircles { 100% { transform: rotate(360deg); } }
-webkit- | reset
animation-play-state: paused | running
.pencil:hover { -webkit-animation-play-state: paused; animation-play-state: paused; }
el.addEventListener( 'webkitAnimationEnd', function( event ) { console.log('Animation Ended'); }, false );
el.addEventListener( 'webkitAnimationEnd', function( event ) { el.removeClassName('newClass'); setTimeout("el.addClassName('newClass')", 100ms) }, false );
webkitAnimationEnd animationend
#AnimDeepDive 5 Sooooo much cowbell