-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
159 lines (158 loc) Β· 9.68 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>CSS Animations Ya'll</title>
<meta name="author" content="Noel Cothren - [email protected]">
<meta name="description" content="Introduction to CSS Animations">
<meta name="keywords" content="CSS,HTML,animations,developer,web,motion,design">
<link rel="icon" href="data:image/svg+xml,
<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22>
<text y=%22.9em%22 font-size=%2290%22>
π€©
</text>
</svg>">
<link href="https://fonts.googleapis.com/css2?family=Cousine:wght@400;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.5.0/themes/prism.min.css"/>
<link rel="stylesheet" href="stylesheet.css" type="text/css">
</head>
<body>
<main>
<nav>
<a href="#π" id="1" title="Hello, world!">π</a>
<a href="#β" id="2" title="Why CSS?">β</a>
<a href="#πΊ" id="3" title="Why animate?">πΊ</a>
<a href="#π
" id="4" title="Easy Transitions">π
</a>
<a href="#π₯" id="5" title="More advanced">π₯β</a>
<a href="#π" id="6" title="Keyframes">π</a>
<a href="#π" id="7" title="Best Practices">π</a>
<a href="#π" id="8" title="Resources">π</a>
</nav>
<section id="π">
<div class="center">
<h1>Intro to CSS Animations</h1>
<p> <pre> <code class="language-xml"> <flash> Hello world! π</flash> </code> </pre> </p>
<p>Noel Cothren πΎ @noeldevelops πΎ [email protected]</p>
<a target="_blank" rel="noopener noreferrer" href="https://github.com/noeldevelops/css-animations-slides">https://github.com/noeldevelops/css-animations-slides</a>
</div>
</section>
<section id="β">
<div class="center">
<h2>Why CSS? β</h2>
<h3>1. Simple, yet powerful.</h3>
<p>All theΒ CSSΒ everΒ written:
<pre><code class="language-css">
selector {
property: value;
}</code></pre>
<a target="_blank" rel="noopener noreferrer" href="http://csszengarden.com/">CSS Zen Garden</a> <br>
<a target="_blank" rel="noopener noreferrer" href="https://resilientwebdesign.com/chapter2/#amatterofstyle">Resilient Web Design</a>
</p>
<h3>2. Performance</h3>
<p>CSS Animations are offloaded to GPU, so keep things off the main thread (Web Animations API does mimic this). <a target="_blank" rel="noopener noreferrer" href="https://www.html5rocks.com/en/tutorials/speed/high-performance-animations/"><blockquote>"Modern browsers can animate four things really cheaply: <strong>position, scale, rotation and opacity</strong>."</blockquote></a>
</p>
<h3>3. Principle of Least Power</h3>
</div>
</section>
<section id="πΊ">
<div class="center">
<h2>Q: Why Animate? πΊ</h2>
<h3>A: Better UX.</h3>
<ul>
<li>It's a communication aid.</li>
<li>Users expect it.</li>
<li>It builds your brand and your site's personality.</li>
</ul>
<a target="_blank" rel="noopener noreferrer" href="https://codepen.io/devtips/pen/AXxGwO/">"Animating the Moments" by DevTips</a>
<blockquote>"Animated user interfaces can be powerful β so powerful that they offer a competitive advantage to their products, regardless of platform." <a href="http://rachelnabors.com/">Rachel Nabors</a>
</blockquote>
</div>
</section>
<section id="π
">
<h2>Easy, lazy animations</h2>
<p>Go from point A to point B using transitions & leverage browser's π§ to figure out the in-betweens. </p>
<p>Syntax:
<pre><code class="language-css"> transition: [property][duration][delay][easing] ... ;</code></pre> </p>
<p>We'll attach the change to <em>a change in the element's state.</em> Here's an example: </p>
<a href="#π
" class="example-link">Hover Me</a>
<pre><code class="language-css">
a.example-link { color: aquamarine; }
a.example-link:hover { color: orangered; }
</code></pre>
<p>Ease-y upgrade: customize the timing function using dev tools or a site like <a target="_blank" rel="noopener noreferrer" href="https://cubic-bezier.com">cubic-bezier.com</a> or <a href="https://easings.net/">easings.net</a></p>
</section>
<section id="π₯">
<h2>Make it Hot with Pseudo Elements</h2>
<h3>Now we're cookin' with gas π₯</h3>
<a href="#π₯" class="button glowy shiny">Hot Button π£</a>
<p>Hey - don't put important content in a pseudo element! It's not real, it's pseudo.</p>
<p>Syntax ( two colons is modern :: ) </p>
<pre><code class="language-css">
.button:hover::before {targets before pseudo element on hover}
.item:hover .info {targets element with .info class when you hover on .item}
</code></pre>
</section>
<section id="π">
<h2>Keyframes for Complex Animations π</h2>
<a target="_blank" rel="noopener noreferrer" href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Animations/Using_CSS_animations">MDN Web Docs</a>
<pre>
<code class="language-css">
.animated {
animation-name: bounce; /* from your keyframes */
animation-duration: 4s; /* s or ms */
animation-iteration-count: 10; /* infinite is an option */
animation-direction: alternate; /* or normal */
animation-timing-function: ease-in-out; /* remember cubic-beziers? */
animation-fill-mode: forwards; /* or backwards, both, none */
animation-delay: 2s; /* or ms */
}
.animated {
animation: duration | timing-function | delay |
iteration-count | direction | fill-mode |
play-state | name;
}
</code>
</pre>
</section>
<section id="π">
<div class="center">
<h2>A Few UI Animation Best Practices π</h2>
<ol>
<li>Don't abuse your animation powers - only write animations that are necessary and useful to our users</li>
<li>Don't conflict with users expectations (e.g. a banking form that "bounces" will be distrusted)</li>
<li>"Performance and accessibility goals affect all aspects of our design work, and animation is no exception there." <a href="https://www.smashingmagazine.com/2019/02/animation-design-system/">Val Head for Smashing Magazine</a>
</li>
<ul>
<li>Avoid animating properties that will trigger layout or paints.</li>
<li>Make sure your animations aren't disturbing users with vestibular disorders or low motion preferences. <a href="https://web.dev/prefers-reduced-motion/">"Prefers reduced motion"</a> media query in Chrome 74</li>
</ul>
</ol>
</div>
</section>
<section id="π">
<div class="center">
<h2>Resources π</h2>
<ul>
<li>All things CSS Animation from <a target="_blank" rel="noopener noreferrer" href="https://cssanimation.rocks/">Donovan Hutchinson</a></li>
<li>Motion in popular design systems:
<ul>
<li><a target="_blank" rel="noopener noreferrer" href="https://material.io/design/motion/">Material</a></li>
<li> <a target="_blank" rel="noopener noreferrer" href="https://www.carbondesignsystem.com/guidelines/motion/basics">Carbon</a> </li>
<li> <a target="_blank" rel="noopener noreferrer" href="https://design-system.pluralsight.com/core/motion">Pluralsight</a> </li>
</ul>
</li>
<li>In Depth on Bezier Curves by <a href="https://www.smashingmagazine.com/2016/08/css-animations-motion-curves/">Smashing Mag</a></li>
<li>Still the best article on CSS Animations Performance from <a target="_blank" rel="noopener noreferrer" href="https://www.html5rocks.com/en/tutorials/speed/high-performance-animations/">HTML5 Rocks</a> </li>
<li>Sarah Drasner's favorite CSS Animations on <a target="_blank" rel="noopener noreferrer" href="https://codepen.io/collection/nmyMop/">Codepen.io</a></li>
<li>HTML+CSS Slides and Emoji URLs by <a target="_blank" rel="noopener noreferrer" href="https://www.chenhuijing.com/blog/html-slides-without-frameworks/#%F0%9F%91%BE">Chen Hui Jing</a> </li>
<li>Emoji favicons and other cool CSS things by <a target="_blank" rel="noopener noreferrer" href="http://lea.verou.me/">Lea Verou</a></li>
<li>Easy code snippets with syntax highlights by <a href="https://www.taniarascia.com/adding-syntax-highlighting-to-code-snippets/">Tania Rascia</a></li>
</ul>
</div>
</section>
</main>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.5.0/prism.min.js"></script>
<script type="text/javascript" src="scripts.js" ></script>
</body>
</html>