Emily Hayman
"Silky smooth" feels fast
On initial page load:
Transform allows:
Instead of:
.box {
left: 10px;
position: absolute;
transition: .2s left;
&.active {
left: 20px;
}
}
Try this:
.box {
transform: translateX(10px);
transition: .2s transform;
&.active {
transform: translateX(20px);
}
}
Instead of:
.box {
background-color: rgba(0,0,0,.9);
transition: .2s background-color;
&.active {
background-color: rgba(0,0,0,1);
}
}
Try this:
.box {
opacity: .9;
background-color: #000;
transition: .2s opacity;
&.active {
opacity: 1;
}
}
backface-visibility: hidden;
"Tricks" the browser into promoting the element
Two methods of creating web animations:
function doSomething() {
requestAnimationFrame(doSomething);
// Do stuff
}
doSomething();
for(i = 0; i < el.length; i++){
var width = element.offsetWidth * 2;
el[i].style.width = width + 'px';
}
var width = element.offsetWidth * 2;
for(i = 0; i < el.length; i++){
el[i].style.width = width + 'px';
}
Bad
Good
Rendering Tools:
Timeline