46 lines
2.0 KiB
HTML
46 lines
2.0 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en" >
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>CodePen - Bouncing Bunnies (animation-delay lesson) 😎</title>
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
|
|
<link rel="stylesheet" href="./style.css">
|
|
|
|
</head>
|
|
<body>
|
|
<!-- partial:index.partial.html -->
|
|
<div class="container">
|
|
<div class="bunny" style="--index: 0;"></div>
|
|
<div class="bunny" style="--index: 1;"></div>
|
|
<div class="bunny" style="--index: 2;"></div>
|
|
<div class="bunny" style="--index: 3;"></div>
|
|
<div class="bunny" style="--index: 4;"></div>
|
|
</div>
|
|
<input type="range" min="0" max="6" value="0"/>
|
|
<h1>No delay</h1>
|
|
<h1>Delay</h1>
|
|
<h1>Negative Delay</h1>
|
|
<h1>Staggered</h1>
|
|
<h1>Staggered w/ Negative Delay</h1>
|
|
<h1>Reverse Stagger</h1>
|
|
<h1>Reverse Stagger w/ Negative Delay</h1>
|
|
<p>Animate simulataneously with no delay</p>
|
|
<p>Animate simulataneously with a delay</p>
|
|
<p>Animate simulataneously with a negative delay</p>
|
|
<p>Use a variable to create a stagger</p>
|
|
<p>Use an offset to make the delays negative so that the elements retain stagger but don't stagger in</p>
|
|
<p>Use the total amount of bunnies to reverse the stagger</p>
|
|
<p>Use a negative coefficient to create a stagger in the opposite direction</p>
|
|
<pre><code>.bunny {</code><code> animation-delay: 0s;</code><code>}</code></pre>
|
|
<pre><code>.bunny {</code><code> animation-delay: 2s;</code><code>}</code></pre>
|
|
<pre><code>.bunny {</code><code> animation-delay: -0.5s;</code><code>}</code></pre>
|
|
<pre><code>.bunny {</code><code> animation-delay: calc(var(--index) * 0.15s);</code><code>}</code></pre>
|
|
<pre><code>.bunny {</code><code> animation-delay: calc((var(--index) - 5) * 0.15s);</code><code>}</code></pre>
|
|
<pre><code>.bunny {</code><code> animation-delay: calc((5 - var(--index)) * 0.15s);</code><code>}</code></pre>
|
|
<pre><code>.bunny {</code><code> animation-delay: calc(var(--index) * -0.15s);</code><code>}</code></pre>
|
|
<!-- partial -->
|
|
<script src="./script.js"></script>
|
|
|
|
</body>
|
|
</html>
|