Skip to content

Commit bf80bf3

Browse files
committed
fix: ensure any anim stage combos work
1 parent d30c52d commit bf80bf3

File tree

3 files changed

+213
-155
lines changed

3 files changed

+213
-155
lines changed

docs-site/src/pages/pattern-lab/_patterns/02-components/animate/05-animate.twig

Lines changed: 85 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,102 @@
33
<button onclick="trigger('in')">Trigger Build In</button>
44
<button onclick="trigger('out')">Trigger Build Out</button>
55
<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>
1773
</div>
1874

1975

76+
<style>
77+
.demo-animate__item {
78+
margin-bottom: 10px;
79+
}
80+
</style>
81+
2082
<script type="application/javascript">
2183
const els = document.querySelectorAll('.demo-animate__items bolt-animate');
2284
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);
2590
});
2691
});
2792
2893
function trigger(type) {
2994
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);
31102
});
32103
}
33104
</script>

packages/components/bolt-animate/animate.schema.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,5 @@ module.exports = {
7979
enum: easings.map(e => e.value),
8080
default: 'ease',
8181
},
82-
83-
trigger: {
84-
type: 'string',
85-
enum: ['in', 'out'],
86-
},
8782
},
8883
};

0 commit comments

Comments
 (0)