|
| 1 | +<!DOCTYPE html> |
| 2 | +<html> |
| 3 | +<head> |
| 4 | +<meta charset="utf-8" /> |
| 5 | +<title>Animating font (and text) properties</title> |
| 6 | +<style type="text/css"> |
| 7 | +html {background: silver;} |
| 8 | +body {background: white; margin: 1em; padding: 1em;} |
| 9 | +label {border: 1px solid rgba(0,0,0,0.5); border-radius: 2ch; padding: 0.5ch 1.5ch; font: bold 1em sans-serif;} |
| 10 | +label:focus {background: yellow;} |
| 11 | +#run:checked + label {color: white; background: darkgreen;} |
| 12 | + |
| 13 | +.arena ol {margin-top: 1em; border-top: 1px solid gray;} |
| 14 | +.arena ol li {animation: 2s 0s paused linear alternate infinite;} |
| 15 | +#run:checked ~ ol li {animation-play-state: running;} |
| 16 | + |
| 17 | +.arena li:nth-child(1) {animation-name: sizer;} |
| 18 | +.arena li:nth-child(2) {animation-name: adjuster;} |
| 19 | +.arena li:nth-child(3) {animation-name: weighter;} |
| 20 | +.arena li:nth-child(4) {animation-name: styler;} |
| 21 | +.arena li:nth-child(5) {animation-name: stretcher;} |
| 22 | +.arena li:nth-child(6) {animation-name: heighter;} |
| 23 | + |
| 24 | +@keyframes sizer { |
| 25 | + from {font-size: 1em;} |
| 26 | + to {font-size: 2em;} |
| 27 | +} |
| 28 | + |
| 29 | +@keyframes heighter { |
| 30 | + from {line-height: 1em;} |
| 31 | + to {line-height: 4em;} |
| 32 | +} |
| 33 | + |
| 34 | +@keyframes weighter { |
| 35 | + from {font-weight: 400;} |
| 36 | + to {font-weight: 900;} |
| 37 | +} |
| 38 | + |
| 39 | +@keyframes styler { |
| 40 | + from {font-style: normal;} |
| 41 | + to {font-style: italic;} |
| 42 | +} |
| 43 | + |
| 44 | +@keyframes styler { |
| 45 | + from {font-stretch: ultra-condensed;} |
| 46 | + to {font-stretch: ultra-expanded;} |
| 47 | +} |
| 48 | + |
| 49 | +@keyframes adjuster { |
| 50 | + from {font-size-adjust: 0.5;} |
| 51 | + to {font-size-adjust: 1;} |
| 52 | +} |
| 53 | +</style> |
| 54 | +</head> |
| 55 | +<body> |
| 56 | + |
| 57 | + |
| 58 | +<form class="arena"> |
| 59 | + |
| 60 | +<input type="checkbox" id="run"> <label for="run">Run animations</label> |
| 61 | + |
| 62 | +<ol> |
| 63 | +<li><p>A paragraph.</p></li> |
| 64 | +<li><p>A paragraph.</p></li> |
| 65 | +<li><p>A paragraph.</p></li> |
| 66 | +<li><p>A paragraph.</p></li> |
| 67 | +<li><p>A paragraph.</p></li> |
| 68 | +<li><p>A paragraph.</p></li> |
| 69 | +</ol> |
| 70 | + |
| 71 | +</form> |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | +</body> |
| 76 | +</html> |
0 commit comments