Transforms in their own properties in CSS
translate, rotate and scale are properties now, so two rules can move the same element.
.chip {
translate: 0 0;
rotate: 0deg;
scale: 1;
transition: translate 150ms ease, rotate 150ms ease, scale 150ms ease;
}
.chip:hover { translate: 0 -2px; scale: 1.03; }
.chip.is-dragging { rotate: 2deg; scale: 1.05; }
.spinner {
transform-origin: center;
animation: spin 900ms linear infinite;
}
@keyframes spin {
to { rotate: 360deg; }
}
How it works
- Separate properties compose instead of overwriting each other.
- The order is always translate, then rotate, then scale.
transformstill works, and still wins as one indivisible value.
Keywords and builtins used here
animationchipdegkeyframesmspxrotatescalespinnertransitiontranslate
The run, in numbers
- Lines
- 18
- Characters to type
- 341
- Tokens
- 95
- Three-star pace
- 90 tpm
At the three-star pace of 90 tokens a minute, this run takes about 63 seconds.
Step 5 of 8 in Motion & effects, step 15 of 21 in Responsive & modern CSS.