|
3 | 3 | <button onclick="trigger('in')">Trigger Build In</button>
|
4 | 4 | <button onclick="trigger('out')">Trigger Build Out</button>
|
5 | 5 | <div class="demo-animate__items">
|
6 |
| - <bolt-animate |
7 |
| - initial-appearance="hidden" |
8 |
| - in="fade-in-slide-left" |
9 |
| - in-duration="1000" |
10 |
| - in-easing="ease-out" |
11 |
| - idle="pulse" |
12 |
| - idle-delay="500" |
13 |
| - out="fade-out-slide-right" |
14 |
| - > |
15 |
| - <h2>Hi!</h2> |
16 |
| - </bolt-animate> |
| 6 | + <div class="demo-animate__item"> |
| 7 | + <bolt-animate |
| 8 | + initial-appearance="hidden" |
| 9 | + in="fade-in" |
| 10 | + in-duration="2000" |
| 11 | + idle="pulse" |
| 12 | + out="fade-out" |
| 13 | + > |
| 14 | + <h2>In, Idle, Out</h2> |
| 15 | + </bolt-animate> |
| 16 | + </div> |
| 17 | + |
| 18 | + <div class="demo-animate__item"> |
| 19 | + <bolt-animate |
| 20 | + initial-appearance="hidden" |
| 21 | + in="fade-in" |
| 22 | + > |
| 23 | + <h2>In</h2> |
| 24 | + </bolt-animate> |
| 25 | + </div> |
| 26 | + |
| 27 | + <div class="demo-animate__item"> |
| 28 | + <bolt-animate |
| 29 | + idle="pulse" |
| 30 | + idle-duration="5000" |
| 31 | + out="fade-out" |
| 32 | + > |
| 33 | + <h2>Idle, Out</h2> |
| 34 | + </bolt-animate> |
| 35 | + </div> |
| 36 | + |
| 37 | + <div class="demo-animate__item"> |
| 38 | + <bolt-animate |
| 39 | + out="fade-out" |
| 40 | + > |
| 41 | + <h2>Out</h2> |
| 42 | + </bolt-animate> |
| 43 | + </div> |
| 44 | + |
| 45 | + <div class="demo-animate__item"> |
| 46 | + <bolt-animate |
| 47 | + initial-appearance="hidden" |
| 48 | + in="fade-in" |
| 49 | + out="fade-out" |
| 50 | + > |
| 51 | + <h2>In, Out</h2> |
| 52 | + </bolt-animate> |
| 53 | + </div> |
| 54 | + |
| 55 | + <div class="demo-animate__item"> |
| 56 | + <bolt-animate |
| 57 | + initial-appearance="hidden" |
| 58 | + in="fade-in" |
| 59 | + idle="pulse" |
| 60 | + > |
| 61 | + <h2>In, Idle</h2> |
| 62 | + </bolt-animate> |
| 63 | + </div> |
| 64 | + |
| 65 | + <div class="demo-animate__item"> |
| 66 | + <bolt-animate |
| 67 | + idle="pulse" |
| 68 | + idle-duration="5000" |
| 69 | + > |
| 70 | + <h2>Idle</h2> |
| 71 | + </bolt-animate> |
| 72 | + </div> |
17 | 73 | </div>
|
18 | 74 |
|
19 | 75 |
|
| 76 | + <style> |
| 77 | + .demo-animate__item { |
| 78 | + margin-bottom: 10px; |
| 79 | + } |
| 80 | + </style> |
| 81 | + |
20 | 82 | <script type="application/javascript">
|
21 | 83 | const els = document.querySelectorAll('.demo-animate__items bolt-animate');
|
22 | 84 | els.forEach(el => {
|
23 |
| - el.addEventListener('bolt-animate:end', event => { |
24 |
| - console.log('pl bolt-animate:end', event); |
| 85 | + el.addEventListener('bolt-animate:end:in', event => { |
| 86 | + console.log('pl bolt-animate:end:in', event); |
| 87 | + }); |
| 88 | + el.addEventListener('bolt-animate:end:out', event => { |
| 89 | + console.log('pl bolt-animate:end:out', event); |
25 | 90 | });
|
26 | 91 | });
|
27 | 92 |
|
28 | 93 | function trigger(type) {
|
29 | 94 | els.forEach(el => {
|
30 |
| - el.setAttribute('trigger', type); |
| 95 | + if (type === 'in') { |
| 96 | + el.triggerAnimIn(); |
| 97 | + } |
| 98 | + if (type === 'out') { |
| 99 | + el.triggerAnimOut(); |
| 100 | + } |
| 101 | + // el.setAttribute('trigger', type); |
31 | 102 | });
|
32 | 103 | }
|
33 | 104 | </script>
|
|
0 commit comments