-
Notifications
You must be signed in to change notification settings - Fork 1
/
atom.xml
365 lines (252 loc) · 27 KB
/
atom.xml
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><![CDATA[A Front End Blog]]></title>
<link href="http://skylar.xyz/atom.xml" rel="self"/>
<link href="http://skylar.xyz/"/>
<updated>2020-10-16T18:29:12-07:00</updated>
<id>http://skylar.xyz/</id>
<author>
<name><![CDATA[Skylar Brown]]></name>
</author>
<generator uri="http://octopress.org/">Octopress</generator>
<entry>
<title type="html"><![CDATA[Fixed attachment CSS gradients]]></title>
<link href="http://skylar.xyz/blog/2020/10/16/fixed-attachment-css-gradients/"/>
<updated>2020-10-16T17:40:30-07:00</updated>
<id>http://skylar.xyz/blog/2020/10/16/fixed-attachment-css-gradients</id>
<content type="html"><![CDATA[<p>Yeah it’s been a while since I last posted. I need to start posting more small things instead of convincing myself that only really big cool things are blog worthy. So, here’s something small.</p>
<p>I was recently admiring the gradient backgrounds on messages in Facebook messenger. Specifically, I liked how the gradient colors stayed relative to your viewport even as you scrolled. I thought it would be fun to attempt to replicate this in CSS.</p>
<p>The way I implemented this was simply to use the desired gradient as a <code>background-image</code> on the element, which allows us to use the powerful css properties that are available for background images. There are quite a few interesting ones that can be used for cool things, like <code>background-position</code> and <code>background-clip</code>, which I may explore some other time. The only property we need to use in this case is <code>background-attachment: fixed;</code> on the message elements. This works much like <code>fixed</code> in other contexts in CSS.</p>
<p>From MDN on <code>background-attachment</code>:</p>
<blockquote><p><code>fixed</code>: The background is fixed relative to the viewport. Even if an element has a scrolling mechanism, the background doesn’t move with the element.</p></blockquote>
<p>Try scrolling on the messages to see the effect in action. Also try switching the color scheme for some more dramatic gradients.</p>
<p class="codepen" data-height="700" data-theme-id="dark" data-default-tab="css,result" data-user="skylarmb" data-slug-hash="WNxwzoR" style="height: 265px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;" data-pen-title="Messenger background gradients">
<span>See the Pen <a href="https://codepen.io/skylarmb/pen/WNxwzoR">
Messenger background gradients</a> by Skylar Brown (<a href="https://codepen.io/skylarmb">@skylarmb</a>)
on <a href="https://codepen.io">CodePen</a>.</span>
</p>
<script async src="https://static.codepen.io/assets/embed/ei.js"></script>
<p>Shoutout to some cool and fun tools I used:</p>
<p>Emojify: <a href="https://matthewmiller.dev/experiments/emojify/">https://matthewmiller.dev/experiments/emojify/</a></p>
<p>Corporate Ipsum: <a href="https://www.cipsum.com">https://www.cipsum.com</a></p>
<p>uiGradients: <a href="https://uigradients.com/">https://uigradients.com/</a></p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[A Simple Input Toggle]]></title>
<link href="http://skylar.xyz/blog/2018/01/27/a-simple-input-toggle/"/>
<updated>2018-01-27T16:39:16-08:00</updated>
<id>http://skylar.xyz/blog/2018/01/27/a-simple-input-toggle</id>
<content type="html"><![CDATA[<p>A simple, animated, and functional all-CSS toggle switch I made for Headnote. It is based on a checkbox input and there is no Javascript required, so you can easily put it right into any existing application where you use checkboxes.</p>
<p><br></p>
<p data-height="265" data-theme-id="0" data-slug-hash="POJpPR" data-default-tab="css,result" data-user="skylarmb" data-embed-version="2" data-pen-title="CSS Toggle" class="codepen">See the Pen <a href="https://codepen.io/skylarmb/pen/POJpPR/">CSS Toggle</a> by Skylar Brown (<a href="https://codepen.io/skylarmb">@skylarmb</a>) on <a href="https://codepen.io">CodePen</a>.</p>
<script async src="https://production-assets.codepen.io/assets/embed/ei.js"></script>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Loading Spinners]]></title>
<link href="http://skylar.xyz/blog/2018/01/27/loading-spinners/"/>
<updated>2018-01-27T16:28:12-08:00</updated>
<id>http://skylar.xyz/blog/2018/01/27/loading-spinners</id>
<content type="html"><![CDATA[<p>Inspired by <a href="https://reddit.com/r/LoadingIcon">/r/LoadingIcon</a>, I made these two CSS loading icons.</p>
<p><br></p>
<p data-height="365" data-theme-id="0" data-slug-hash="ZvLoPG" data-default-tab="css,result" data-user="skylarmb" data-embed-version="2" data-pen-title="squares3" class="codepen">See the Pen <a href="https://codepen.io/skylarmb/pen/ZvLoPG/">squares3</a> by Skylar Brown (<a href="https://codepen.io/skylarmb">@skylarmb</a>) on <a href="https://codepen.io">CodePen</a>.</p>
<script async src="https://production-assets.codepen.io/assets/embed/ei.js"></script>
<p data-height="365" data-theme-id="0" data-slug-hash="zpNjLr" data-default-tab="css,result" data-user="skylarmb" data-embed-version="2" data-pen-title="squares2" class="codepen">See the Pen <a href="https://codepen.io/skylarmb/pen/zpNjLr/">squares2</a> by Skylar Brown (<a href="https://codepen.io/skylarmb">@skylarmb</a>) on <a href="https://codepen.io">CodePen</a>.</p>
<script async src="https://production-assets.codepen.io/assets/embed/ei.js"></script>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[A break from the norm]]></title>
<link href="http://skylar.xyz/blog/2017/07/21/a-break-from-the-norm/"/>
<updated>2017-07-21T21:20:57-07:00</updated>
<id>http://skylar.xyz/blog/2017/07/21/a-break-from-the-norm</id>
<content type="html"><![CDATA[<p>I usually post about code, but today I want to post about tooling and process. There are a few things that greatly aide my productivity that I would like to share. In no particular order, here are things I think can save you somewhere on the order of hours per day in productivity, not to mention your sanity.</p>
<h5>1. Make notes for yourself</h5>
<p>Every day before I leave I spend 30 seconds writing myself a couple notes about where I left off and what I have on my mind. I use <a href="https://www.google.com/keep/" target="_blank">Google Keep</a> to take notes, but to each their own. These notes are wonderful the next morning as I can pick up right where I left off, and even refer to them throughout the day to remember the small things that might otherwise slip through the cracks.</p>
<h5>2. Create shortcuts</h5>
<p>Allow yourself to do things faster. I create endless shortcuts. Here are just a few of them</p>
<ul>
<li>I have browser bookmarks for all the services and sites I need to use daily, with shortened names so that more fit on the bookmark bar.</li>
<li>I use LastPass to manage passwords. I log in once in the morning and never have to worry about remembering credentials for the rest of the day.</li>
<li>I have TONS of aliases. Check out my <a href="https://github.com/skylarmb/dotfiles/blob/master/.zshrc" target="_blank"><code>.zshrc</code></a>, my <a href="https://github.com/skylarmb/dotfiles/blob/master/.gitconfig" target="_blank"><code>.gitconfig</code></a>, or my <a href="https://github.com/skylarmb/dotfiles/blob/master/.vimrc" target="_blank"><code>.vimrc</code></a>.</li>
<li>I use BetterTouchTool to set up keyboard shortcuts for moving windows to different monitors, minimizing, maximizing, snapping, etc. You can find my config <a href="https://github.com/skylarmb/dotfiles/blob/master/btt.json" target="_blank">here</a>.</li>
<li>I have trackpad gestures to close tabs, switch tabs, switch windows, switch desktops, etc (included in above BTT config).</li>
</ul>
<h5>3. Be proactive</h5>
<p>Investing time up front will save time in the long run. Shitty build process that requires <!-- more -->you to alt-tab and restart a script just to test your change? Invest a day or two or three now to automate process. I promise you that you will save a ton of time and sanity in the long run.</p>
<h5>4. Get good at context switching</h5>
<p>Inevitably we will all have to context switch. Things come up, prod deploys explode in your face, people need help with something. I segment my work very methodically. If I context switch to some other issue, I minimize my browser window with all my current tabs, minimize my terminal, and any other related windows. I then open new windows to deal with the new issue. This way I can easily pick up <em>exactly</em> where I left off on my previous task with zero effort. The amount of time I see my coworkers wasting searching through their 100 open tabs for that one they needed from 4 hours ago can be painful sometimes.</p>
<h5>5. Speak up</h5>
<p>At the end of the day, the reason you have a manager or someone you report to is to make sure you are getting the resources you need to do your job, and that the company is getting the most they can out of you as an employee. If there is a process, formality, or meeting you think is wasting your time or others' time, bring it up with someone. I’ll bet you a nickel you won’t meet much resistance if you make helpful suggestions about how to improve processes on your team (don’t just complain with no suggestions for improvements).</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Animated markers on an SVG map]]></title>
<link href="http://skylar.xyz/blog/2017/05/28/map-markers/"/>
<updated>2017-05-28T17:07:03-07:00</updated>
<id>http://skylar.xyz/blog/2017/05/28/map-markers</id>
<content type="html"><![CDATA[<p>I recently started my new job at <a href="https://headnote.com">Headnote</a>. My first project was to redo all of the public facing pages to update the branding and advertising language. The one piece of code I would like to share from the experience is the animated markers that pop up in various places on a map. Now, I am new to Less (purely a Sass guy before this gig), so this was a great learning experience for me about what advanced features Less supports compared to Sass. There were definitely some challenges. The main one being that Less is much less flexible (no pun intended) in terms of interpolation and apparently is very very picky about using variables / interpolation on the <em>left</em> side of a definition (I dont know what else to call it)… For example:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class='scss'><span class='line'><span class="k">@side</span><span class="nd">:</span> <span class="nt">left</span><span class="o">;</span>
</span><span class='line'>
</span><span class='line'><span class="nc">.my-class</span> <span class="p">{</span>
</span><span class='line'> <span class="nt">margin-</span><span class="o">@</span><span class="p">{</span><span class="nt">side</span><span class="p">}</span><span class="nd">:</span> <span class="nt">5px</span><span class="o">;</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>
<p>This particular example works… however when I tried to use this sort of interpolation for keyframe animation<!--more-->, Less complained endlessly. Admittedly this is a bit of an edge case. I tried every possible combination of escaping, string concatenation, interpolation, etc and could get neither the <code>%</code> sign needed for defining keyframes nor inline math to work. In my experience, <a href="https://gist.github.com/skylarmb/258236d9887041b2e78e26c02e963a11">Sass is a bit more forgiving in this regard</a>, although I havent tried re-creating this exact code in Sass.</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
</pre></td><td class='code'><pre><code class='scss'><span class='line'><span class="nc">.map-keyframe-set</span><span class="o">(@</span><span class="nt">base-percent</span><span class="o">,</span> <span class="o">@</span><span class="nt">offset</span><span class="o">)</span> <span class="p">{</span>
</span><span class='line'> <span class="o">@</span><span class="p">{</span><span class="nt">base-percent</span><span class="p">}</span><span class="err">%</span> <span class="p">{</span> <span class="c1">// syntax error!</span>
</span><span class='line'> <span class="na">opacity</span><span class="o">:</span> <span class="mi">0</span><span class="p">;</span>
</span><span class='line'> <span class="p">}</span>
</span><span class='line'> <span class="o">(@</span><span class="p">{</span><span class="nt">base-percent</span><span class="p">}</span><span class="o">)</span><span class="err">%</span> <span class="p">{</span> <span class="c1">// syntax error!</span>
</span><span class='line'> <span class="na">opacity</span><span class="o">:</span> <span class="mi">0</span><span class="p">;</span>
</span><span class='line'> <span class="p">}</span>
</span><span class='line'> <span class="o">@</span><span class="p">{</span><span class="nt">base-percent</span><span class="p">}</span><span class="err">\%</span> <span class="p">{</span> <span class="c1">// escaping doesnt work!</span>
</span><span class='line'> <span class="na">opacity</span><span class="o">:</span> <span class="mi">0</span><span class="p">;</span>
</span><span class='line'> <span class="p">}</span>
</span><span class='line'> <span class="o">@</span><span class="p">{</span><span class="nt">base-percent</span><span class="p">}</span><span class="o">~</span><span class="s2">"%"</span> <span class="p">{</span> <span class="c1">// this escaping doesnt work either!</span>
</span><span class='line'> <span class="na">opacity</span><span class="o">:</span> <span class="mi">0</span><span class="p">;</span>
</span><span class='line'> <span class="p">}</span>
</span><span class='line'> <span class="s2">"@{base-percent}%"</span> <span class="p">{</span> <span class="c1">// Nope!</span>
</span><span class='line'> <span class="na">opacity</span><span class="o">:</span> <span class="mi">0</span><span class="p">;</span>
</span><span class='line'> <span class="p">}</span>
</span><span class='line'> <span class="o">@</span><span class="p">{</span><span class="nt">base-percent</span><span class="p">}</span> <span class="o">+</span> <span class="o">@</span><span class="p">{</span><span class="nt">offset</span><span class="p">}</span> <span class="p">{</span> <span class="c1">// math doesnt work!</span>
</span><span class='line'> <span class="na">opacity</span><span class="o">:</span> <span class="mi">0</span><span class="p">;</span>
</span><span class='line'> <span class="p">}</span>
</span><span class='line'> <span class="o">(@</span><span class="p">{</span><span class="nt">base-percent</span><span class="p">}</span> <span class="o">+</span> <span class="o">@</span><span class="p">{</span><span class="nt">offset</span><span class="p">}</span><span class="o">)</span> <span class="p">{</span> <span class="c1">// math doesnt work!</span>
</span><span class='line'> <span class="na">opacity</span><span class="o">:</span> <span class="mi">0</span><span class="p">;</span>
</span><span class='line'> <span class="p">}</span>
</span><span class='line'> <span class="c1">//...</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>
<p>Believe me, these are not all the syntaxes I tried. I spent almost an hour being stubborn about this… I ended up going with a simple but extremely un-satisfying solution. Pass values in as percentages and do the percentage math first, then use the resulting value in the definition.</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
</pre></td><td class='code'><pre><code class='scss'><span class='line'><span class="nc">.map-keyframe-set</span><span class="o">(@</span><span class="nt">base-percent</span><span class="o">,</span> <span class="o">@</span><span class="nt">offset</span><span class="o">)</span> <span class="p">{</span>
</span><span class='line'> <span class="k">@start</span><span class="nd">:</span> <span class="o">(@</span><span class="nt">base-percent</span> <span class="o">+</span> <span class="o">@</span><span class="nt">offset</span><span class="o">);</span>
</span><span class='line'>
</span><span class='line'> <span class="o">@</span><span class="p">{</span><span class="nt">start</span><span class="p">}</span> <span class="p">{</span> <span class="c1">// OK!</span>
</span><span class='line'> <span class="na">opacity</span><span class="o">:</span> <span class="mi">0</span><span class="p">;</span>
</span><span class='line'> <span class="p">}</span>
</span><span class='line'> <span class="c1">//...</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>
<p>Anyways, here is the result! PLEASE open this in a new tab, you cannot see the whole map in this tiny iframe</p>
<p data-height="580" data-theme-id="0" data-slug-hash="KmLeXd" data-default-tab="css,result" data-user="skylarmb" data-embed-version="2" data-pen-title="KmLeXd" class="codepen">See the Pen <a href="https://codepen.io/skylarmb/pen/KmLeXd/">KmLeXd</a> by Skylar Brown (<a href="https://codepen.io/skylarmb">@skylarmb</a>) on <a href="https://codepen.io">CodePen</a>.</p>
<script async src="https://production-assets.codepen.io/assets/embed/ei.js"></script>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Cubic Bezier Curves]]></title>
<link href="http://skylar.xyz/blog/2016/08/07/cubic-beziers/"/>
<updated>2016-08-07T11:13:16-07:00</updated>
<id>http://skylar.xyz/blog/2016/08/07/cubic-beziers</id>
<content type="html"><![CDATA[<h4>Preface</h4>
<p>Everything I make is made to work in the latest chrome. Because this is a dev blog I don’t bother with vendor prefixes / browser compatibility.</p>
<h4>Curves</h4>
<p>A cubic bezier curve in CSS looks like a bunch of random numbers.</p>
<pre><code class="css">.class {
transition: all 1s cubic-bezier(0.95, 0.05, 0.795, 0.035);
}
</code></pre>
<p>What do those values mean? First lets understand the structure and a cubic bezier curve.</p>
<p><img src="http://skylar.xyz/images/bezier.png" alt="" /></p>
<p>A curve is defined by four points<!--more-->. In the above diagram, P<sub>0</sub> through P<sub>3</sub>. However, P<sub>0</sub> and P<sub>3</sub> always have the coordinates <code>(0,0)</code> and <code>(1,1)</code> respectively, so we only need to define the coordinates of P<sub>1</sub> and P<sub>2</sub>. The four values define the X and Y coordinates of those two points, like so:</p>
<pre><code class="css">.class {
transition: all 1s cubic-bezier(P1x, P1y, P2x, P2y);
}
</code></pre>
<p>You can play around with a bezier curve generator tool like <a href="http://cubic-bezier.com/">cubic-bezier.com</a> if you are curious how the coordinates of these points effect the curve. Disclaimer: I have never made a cubic bezier ‘by hand’ because there are so many awesome resources like <a href="http://easings.net">easings.net</a> from which you can copy paste.</p>
<h4>The Fun Part (making pretty things)</h4>
<h6>Two opposite curves</h6>
<p>The two curves I am going to use below are these, taken from <a href="http://easings.net">easings.net</a></p>
<p><img src="http://i.imgur.com/CLiT6g7.png" alt="" /></p>
<p><code>easeInExpo</code> is called <code>$delayed</code> in the code as it starts out basically doing nothing and then quickly goes to 100%. <code>easeOutExpo</code> is called <code>$immediate</code> as it goes to 100% very quickly and then levels off. Note: I hate naming variables.</p>
<h6>Transitioning multiple properties</h6>
<p>There are a surprising number of stack overflow questions where people don’t know you can define different transitions for different properties, like so:</p>
<pre><code class="css">.class {
transition: font-size 1s $immediate, transform 1s $delayed;
}
</code></pre>
<p>Going further, what if you want to transition <code>font-size</code> with <code>$immediate</code>, <code>transform</code> with <code>$delayed</code>, <em>and</em> <code>opacity</code> with <code>$immediate</code>? That line starts to get long really fast. A neat trick is to transition <code>all</code> with the most common easing and then any ones following <code>all</code> are effectively overridden.</p>
<pre><code class="css">.class {
transition: all 1s $immediate, transform 1s $delayed;
}
</code></pre>
<h6>Putting it all together</h6>
<p>Consider the case of creating a sort of two-stage effect on a div. First make it wider, then make it taller. A lot of time people use Javascript to first apply a class to transition the width, and then half a second later another class to transition the height. But why use JS for something so simple? The pure CSS solution is to transition two ‘opposite’ bezier curve easings on two separate properties (<code>width</code> and <code>height</code>) like the example above, and you can get a great two-stage effect.</p>
<h6>The Result</h6>
<p data-height="500" data-theme-id="0" data-slug-hash="qNJZZO" data-default-tab="css,result" data-user="skylarmb" data-embed-version="2" class="codepen">See the Pen <a href="http://codepen.io/skylarmb/pen/qNJZZO/">cubic bezier animation</a> by Skylar Brown (<a href="http://codepen.io/skylarmb">@skylarmb</a>) on <a href="http://codepen.io">CodePen</a>.</p>
<script async src="//assets.codepen.io/assets/embed/ei.js"></script>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[a rainbow thing]]></title>
<link href="http://skylar.xyz/blog/2016/06/04/a-rainbow-thing/"/>
<updated>2016-06-04T21:23:13-07:00</updated>
<id>http://skylar.xyz/blog/2016/06/04/a-rainbow-thing</id>
<content type="html"><![CDATA[<p>I came across this gif on reddit today.
<br>
<br>
<img src="https://s-media-cache-ak0.pinimg.com/originals/50/b4/97/50b497753dc91b55c5410f531935d7c3.gif">
<br>
<br></p>
<p>No idea how it was made but thought it would be an interesting challenge to replicate it with css keyframe animation. I explicitly set out to do this with no javascript just to explore the limitations of keyframe animation, and yes, I am well aware that the problems listed below can all be solved with JS. Thats not the point.</p>
<p>Here are some interesting limitations of keyframe animation that I came across while doing this.</p>
<h6>Problem 1: Iteration Delays</h6>
<p>As helpful as the <code>animation-delay</code> property can be, it only delays the start of the animation relative to page load (or to when the animation was applied to the element). There is no delay-per-iteration type property. I would love to be able to specify an animation something like this…</p>
<!--more-->
<pre><code class="css">.animate {
animation: spin 1s ease-in-out infinite;
animation-iteration-delay: 0.2s;
}
</code></pre>
<p>meaning the animation would loop infinitely, still taking 1 second to complete, but delaying for 0.2s before starting its 1s loop again. While searching around for workarounds I found <a href="http://lists.w3.org/Archives/Public/www-style/2011May/0549.html">this</a> discussion of this exact topic.</p>
<p>If I had been able to use something like that, my code below could have been a lot simpler. The way I did it was generating keyframe sets for each segment (<code>spin-0</code>, <code>spin-1</code>, etc…) that were all just different divisions of the total animation loop time (like hours on a clock). Segment 0 “plays” from noon to 1, and explicitly does nothing from 1 til midnight. Segment 1 “plays” from 1 to 2… etc. Instead of this wonkyness, you could just have a single <code>spin</code> animation (as simple as a <code>from {...} to {...}</code>) that lasts for the actual amount of time the <code>spin</code> animation runs (1h in the clock analogy) with none of this mathy percentage stuff. Each segment would just get an <code>animation-delay</code> according to it’s position in the circle and an <code>animation-iteration-delay</code> equal to the total animation loop time.</p>
<h6>Problem 2: The 100% keyframe</h6>
<p>Animations always start at 0% and end at 100%. That makes sense. However it would be pretty cool if you could <a href="https://www.youtube.com/watch?v=lIFE7h3m40U">bodge</a> that a little and <em>if</em> keyframes over 100% were defined, it would play through them at the apropriate time scale (as in an animation with 0-120% keyframes defined would take 120% of its animation time to complete). This would have come in handy at the end of the animation loop where it would be great to start the next loop of the animation before the last one was done. Overlap if you will. Of course this was only a limitation because of the above mentioned limitation with iteration delays… That would be the real way to solve this.</p>
<p>Anyways, it’s nowhere near perfect as you can see. It doesn’t loop properly for the reasons above, and I could have done better with the positioning so that when it loops there isn’t a clear jump as it resets.</p>
<h6>The actual code</h6>
<p>I highly recommend opening it on codepen to see it in a less cramped view.
<br>
<br></p>
<p data-height="425" data-theme-id="0" data-slug-hash="ZOGMzZ" data-default-tab="css,result" data-user="skylarmb" data-embed-version="2" class="codepen">See the Pen <a href="https://codepen.io/skylarmb/pen/ZOGMzZ/">ZOGMzZ</a> by Skylar Brown (<a href="http://codepen.io/skylarmb">@skylarmb</a>) on <a href="http://codepen.io">CodePen</a>.</p>
<script async src="//assets.codepen.io/assets/embed/ei.js"></script>
]]></content>
</entry>
</feed>