@dotcraft/avatar 0.6.4 → 0.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/composer/ComposerMascot.d.ts.map +1 -1
- package/dist/composer/ComposerMascot.js +32 -106
- package/dist/composer/ComposerMascot.js.map +1 -1
- package/dist/composer/MascotIdleStage.d.ts +11 -0
- package/dist/composer/MascotIdleStage.d.ts.map +1 -0
- package/dist/composer/MascotIdleStage.js +9 -0
- package/dist/composer/MascotIdleStage.js.map +1 -0
- package/dist/composer/constants.d.ts +12 -1
- package/dist/composer/constants.d.ts.map +1 -1
- package/dist/composer/constants.js +9 -4
- package/dist/composer/constants.js.map +1 -1
- package/dist/composer/styles/idle.css +116 -105
- package/dist/composer/useComposerAvatarBehavior.d.ts +1 -0
- package/dist/composer/useComposerAvatarBehavior.d.ts.map +1 -1
- package/dist/composer/useComposerAvatarBehavior.js +2 -2
- package/dist/composer/useComposerAvatarBehavior.js.map +1 -1
- package/dist/composer/useMascotActiveIdle.d.ts +33 -0
- package/dist/composer/useMascotActiveIdle.d.ts.map +1 -0
- package/dist/composer/useMascotActiveIdle.js +128 -0
- package/dist/composer/useMascotActiveIdle.js.map +1 -0
- package/dist/react.d.ts +5 -0
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +4 -0
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
- package/src/composer/ComposerMascot.tsx +36 -112
- package/src/composer/MascotIdleStage.tsx +23 -0
- package/src/composer/constants.ts +25 -4
- package/src/composer/styles/idle.css +116 -105
- package/src/composer/useComposerAvatarBehavior.ts +3 -2
- package/src/composer/useMascotActiveIdle.ts +170 -0
- package/src/react.ts +5 -0
|
@@ -2,74 +2,84 @@
|
|
|
2
2
|
opacity: 0;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
/* A trip heads `--mascot-idle-dir`; each leg moves along `--mascot-idle-travel-sign` (left is -1). */
|
|
6
|
+
.composer-mascot-active-idle {
|
|
7
|
+
--mascot-idle-dir: -1;
|
|
8
|
+
--mascot-idle-travel-sign: -1;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.composer-mascot-active-idle[data-mascot-idle-direction='right'] {
|
|
12
|
+
--mascot-idle-dir: 1;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.composer-mascot-active-idle[data-mascot-idle-travel='right'] {
|
|
16
|
+
--mascot-idle-travel-sign: 1;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.composer-mascot-active-idle .composer-mascot-stage {
|
|
20
|
+
position: relative;
|
|
6
21
|
top: 0;
|
|
7
22
|
left: 0;
|
|
8
23
|
}
|
|
9
24
|
|
|
10
|
-
.composer-mascot-active-idle[data-mascot-idle-phase='away'] .composer-mascot-
|
|
25
|
+
.composer-mascot-active-idle[data-mascot-idle-phase='away'] .composer-mascot-body {
|
|
11
26
|
animation: none;
|
|
12
27
|
transform: scale(1);
|
|
13
28
|
}
|
|
14
29
|
|
|
15
|
-
.
|
|
16
|
-
.composer-mascot-active-idle[data-mascot-active-idle='hop'][data-mascot-idle-phase='
|
|
17
|
-
|
|
30
|
+
/* The stage parks at the far end in its own (possibly scaled) space while the travel layer rests at zero. */
|
|
31
|
+
.composer-mascot-active-idle[data-mascot-active-idle='hop'][data-mascot-idle-phase='away'] .composer-mascot-stage,
|
|
32
|
+
.composer-mascot-active-idle[data-mascot-active-idle='hop'][data-mascot-idle-phase='inbound'] .composer-mascot-stage {
|
|
33
|
+
left: calc(280px * var(--mascot-idle-stage-scale, 1) * var(--mascot-idle-dir, -1));
|
|
18
34
|
}
|
|
19
35
|
|
|
20
|
-
.composer-mascot-active-idle[data-mascot-active-idle='rocket'][data-mascot-idle-phase='away'] .composer-mascot-
|
|
21
|
-
.composer-mascot-active-idle[data-mascot-active-idle='rocket'][data-mascot-idle-phase='inbound'] .composer-mascot-
|
|
22
|
-
left: -
|
|
36
|
+
.composer-mascot-active-idle[data-mascot-active-idle='rocket'][data-mascot-idle-phase='away'] .composer-mascot-stage,
|
|
37
|
+
.composer-mascot-active-idle[data-mascot-active-idle='rocket'][data-mascot-idle-phase='inbound'] .composer-mascot-stage {
|
|
38
|
+
left: calc(293.33px * var(--mascot-idle-stage-scale, 1) * var(--mascot-idle-dir, -1));
|
|
23
39
|
}
|
|
24
40
|
|
|
25
|
-
.composer-mascot-active-idle[data-mascot-active-idle='hover'][data-mascot-idle-phase='away'] .composer-mascot-
|
|
26
|
-
.composer-mascot-active-idle[data-mascot-active-idle='hover'][data-mascot-idle-phase='inbound'] .composer-mascot-
|
|
27
|
-
top: -
|
|
28
|
-
left: -
|
|
41
|
+
.composer-mascot-active-idle[data-mascot-active-idle='hover'][data-mascot-idle-phase='away'] .composer-mascot-stage,
|
|
42
|
+
.composer-mascot-active-idle[data-mascot-active-idle='hover'][data-mascot-idle-phase='inbound'] .composer-mascot-stage {
|
|
43
|
+
top: calc(-128px * var(--mascot-idle-stage-scale, 1));
|
|
44
|
+
left: calc(200px * var(--mascot-idle-stage-scale, 1) * var(--mascot-idle-dir, -1));
|
|
29
45
|
}
|
|
30
46
|
|
|
31
|
-
.composer-mascot-active-idle .composer-mascot-
|
|
32
|
-
.composer-mascot-active-idle .composer-mascot-
|
|
33
|
-
.composer-mascot-active-idle .composer-mascot-
|
|
47
|
+
.composer-mascot-active-idle .composer-mascot-travel,
|
|
48
|
+
.composer-mascot-active-idle .composer-mascot-lift,
|
|
49
|
+
.composer-mascot-active-idle .composer-mascot-body {
|
|
34
50
|
transform-origin: bottom center;
|
|
35
51
|
will-change: transform;
|
|
36
52
|
}
|
|
37
53
|
|
|
38
|
-
.composer-mascot-active-idle .composer-mascot-
|
|
54
|
+
.composer-mascot-active-idle .composer-mascot-travel {
|
|
55
|
+
position: relative;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.composer-mascot-active-idle .composer-mascot-lift {
|
|
39
59
|
position: relative;
|
|
40
60
|
z-index: 1;
|
|
41
61
|
}
|
|
42
62
|
|
|
43
|
-
.composer-mascot-active-idle[data-mascot-active-idle='hop'][data-mascot-idle-phase='outbound'] .composer-mascot-
|
|
44
|
-
.composer-mascot-active-idle[data-mascot-active-idle='hop'][data-mascot-idle-phase='inbound'] .composer-mascot-
|
|
63
|
+
.composer-mascot-active-idle[data-mascot-active-idle='hop'][data-mascot-idle-phase='outbound'] .composer-mascot-travel,
|
|
64
|
+
.composer-mascot-active-idle[data-mascot-active-idle='hop'][data-mascot-idle-phase='inbound'] .composer-mascot-travel {
|
|
45
65
|
--mascot-hop-compress-y: 0.82px;
|
|
46
66
|
--mascot-hop-apex-y: -11.44px;
|
|
47
67
|
--mascot-hop-fall-y: -2.86px;
|
|
48
68
|
--mascot-hop-land-y: 0.41px;
|
|
69
|
+
--mascot-hop-distance: calc(280px * var(--mascot-idle-travel-sign, -1));
|
|
70
|
+
--mascot-hop-x-1: calc(70px * var(--mascot-idle-travel-sign, -1));
|
|
71
|
+
--mascot-hop-x-2: calc(140px * var(--mascot-idle-travel-sign, -1));
|
|
72
|
+
--mascot-hop-x-3: calc(210px * var(--mascot-idle-travel-sign, -1));
|
|
49
73
|
animation: composer-mascot-idle-hop-travel 2.4s linear forwards;
|
|
50
74
|
}
|
|
51
75
|
|
|
52
|
-
.composer-mascot-active-idle[data-mascot-active-idle='hop'][data-mascot-idle-phase='outbound'] .composer-mascot-
|
|
53
|
-
|
|
54
|
-
--mascot-hop-x-1: -70px;
|
|
55
|
-
--mascot-hop-x-2: -140px;
|
|
56
|
-
--mascot-hop-x-3: -210px;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.composer-mascot-active-idle[data-mascot-active-idle='hop'][data-mascot-idle-phase='inbound'] .composer-mascot-motion > div:first-child {
|
|
60
|
-
--mascot-hop-distance: 280px;
|
|
61
|
-
--mascot-hop-x-1: 70px;
|
|
62
|
-
--mascot-hop-x-2: 140px;
|
|
63
|
-
--mascot-hop-x-3: 210px;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.composer-mascot-active-idle[data-mascot-active-idle='hop'][data-mascot-idle-phase='outbound'] .composer-mascot-breathe,
|
|
67
|
-
.composer-mascot-active-idle[data-mascot-active-idle='hop'][data-mascot-idle-phase='inbound'] .composer-mascot-breathe {
|
|
76
|
+
.composer-mascot-active-idle[data-mascot-active-idle='hop'][data-mascot-idle-phase='outbound'] .composer-mascot-body,
|
|
77
|
+
.composer-mascot-active-idle[data-mascot-active-idle='hop'][data-mascot-idle-phase='inbound'] .composer-mascot-body {
|
|
68
78
|
animation: composer-mascot-idle-hop-body 600ms linear 4;
|
|
69
79
|
}
|
|
70
80
|
|
|
71
|
-
.composer-mascot-active-idle[data-mascot-active-idle='hop'] .composer-mascot-
|
|
72
|
-
.composer-mascot-active-idle[data-mascot-active-idle='rocket'] .composer-mascot-
|
|
81
|
+
.composer-mascot-active-idle[data-mascot-active-idle='hop'] .composer-mascot-travel::before,
|
|
82
|
+
.composer-mascot-active-idle[data-mascot-active-idle='rocket'] .composer-mascot-travel::before {
|
|
73
83
|
content: '';
|
|
74
84
|
position: absolute;
|
|
75
85
|
bottom: -1px;
|
|
@@ -85,8 +95,8 @@
|
|
|
85
95
|
transform-origin: center;
|
|
86
96
|
}
|
|
87
97
|
|
|
88
|
-
.composer-mascot-active-idle[data-mascot-active-idle='hop'][data-mascot-idle-phase='outbound'] .composer-mascot-
|
|
89
|
-
.composer-mascot-active-idle[data-mascot-active-idle='hop'][data-mascot-idle-phase='inbound'] .composer-mascot-
|
|
98
|
+
.composer-mascot-active-idle[data-mascot-active-idle='hop'][data-mascot-idle-phase='outbound'] .composer-mascot-travel::before,
|
|
99
|
+
.composer-mascot-active-idle[data-mascot-active-idle='hop'][data-mascot-idle-phase='inbound'] .composer-mascot-travel::before {
|
|
90
100
|
animation: composer-mascot-idle-hop-shadow 600ms ease-in-out 4;
|
|
91
101
|
}
|
|
92
102
|
|
|
@@ -115,48 +125,40 @@
|
|
|
115
125
|
90% { opacity: 0.76; transform: translateX(-50%) scaleX(1.12); }
|
|
116
126
|
}
|
|
117
127
|
|
|
118
|
-
.composer-mascot-active-idle[data-mascot-active-idle='rocket'][data-mascot-idle-phase='outbound'] .composer-mascot-
|
|
119
|
-
.composer-mascot-active-idle[data-mascot-active-idle='rocket'][data-mascot-idle-phase='inbound'] .composer-mascot-
|
|
128
|
+
.composer-mascot-active-idle[data-mascot-active-idle='rocket'][data-mascot-idle-phase='outbound'] .composer-mascot-travel,
|
|
129
|
+
.composer-mascot-active-idle[data-mascot-active-idle='rocket'][data-mascot-idle-phase='inbound'] .composer-mascot-travel {
|
|
120
130
|
--mascot-rocket-apex-y: -66.99px;
|
|
121
131
|
--mascot-rocket-crouch-y: 1.23px;
|
|
122
132
|
--mascot-rocket-air-y: -2.04px;
|
|
123
133
|
--mascot-rocket-approach-y: -0.82px;
|
|
124
134
|
--mascot-rocket-rebound-y: -1.23px;
|
|
135
|
+
--mascot-flight-distance: calc(293.33px * var(--mascot-idle-travel-sign, -1));
|
|
136
|
+
--mascot-rocket-tilt: calc(8deg * var(--mascot-idle-travel-sign, -1));
|
|
125
137
|
animation: composer-mascot-idle-rocket-flight-x 1.8s linear forwards;
|
|
126
138
|
}
|
|
127
139
|
|
|
128
|
-
.composer-mascot-active-idle[data-mascot-active-idle='rocket'][data-mascot-idle-phase='outbound'] .composer-mascot-
|
|
129
|
-
|
|
130
|
-
--mascot-rocket-tilt: -8deg;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.composer-mascot-active-idle[data-mascot-active-idle='rocket'][data-mascot-idle-phase='inbound'] .composer-mascot-motion > div:first-child {
|
|
134
|
-
--mascot-flight-distance: 293.33px;
|
|
135
|
-
--mascot-rocket-tilt: 8deg;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.composer-mascot-active-idle[data-mascot-active-idle='rocket'][data-mascot-idle-phase='outbound'] .composer-mascot-motion > div:first-child > div:first-child,
|
|
139
|
-
.composer-mascot-active-idle[data-mascot-active-idle='rocket'][data-mascot-idle-phase='inbound'] .composer-mascot-motion > div:first-child > div:first-child {
|
|
140
|
+
.composer-mascot-active-idle[data-mascot-active-idle='rocket'][data-mascot-idle-phase='outbound'] .composer-mascot-lift,
|
|
141
|
+
.composer-mascot-active-idle[data-mascot-active-idle='rocket'][data-mascot-idle-phase='inbound'] .composer-mascot-lift {
|
|
140
142
|
animation: composer-mascot-idle-rocket-flight-y 1.8s linear forwards;
|
|
141
143
|
}
|
|
142
144
|
|
|
143
|
-
.composer-mascot-active-idle[data-mascot-active-idle='rocket'][data-mascot-idle-phase='outbound'] .composer-mascot-
|
|
144
|
-
.composer-mascot-active-idle[data-mascot-active-idle='rocket'][data-mascot-idle-phase='inbound'] .composer-mascot-
|
|
145
|
+
.composer-mascot-active-idle[data-mascot-active-idle='rocket'][data-mascot-idle-phase='outbound'] .composer-mascot-body,
|
|
146
|
+
.composer-mascot-active-idle[data-mascot-active-idle='rocket'][data-mascot-idle-phase='inbound'] .composer-mascot-body {
|
|
145
147
|
animation: composer-mascot-idle-rocket-body 1.8s ease-out forwards;
|
|
146
148
|
}
|
|
147
149
|
|
|
148
|
-
.composer-mascot-active-idle[data-mascot-active-idle='rocket'][data-mascot-idle-phase='outbound'] .composer-mascot-
|
|
149
|
-
.composer-mascot-active-idle[data-mascot-active-idle='rocket'][data-mascot-idle-phase='inbound'] .composer-mascot-
|
|
150
|
+
.composer-mascot-active-idle[data-mascot-active-idle='rocket'][data-mascot-idle-phase='outbound'] .composer-mascot-travel::before,
|
|
151
|
+
.composer-mascot-active-idle[data-mascot-active-idle='rocket'][data-mascot-idle-phase='inbound'] .composer-mascot-travel::before {
|
|
150
152
|
animation: composer-mascot-idle-flight-shadow 1.8s ease-in-out forwards;
|
|
151
153
|
}
|
|
152
154
|
|
|
153
|
-
.composer-mascot-active-idle[data-mascot-active-idle='rocket'] .composer-mascot-
|
|
155
|
+
.composer-mascot-active-idle[data-mascot-active-idle='rocket'] .composer-mascot-trail {
|
|
154
156
|
position: relative;
|
|
155
157
|
isolation: isolate;
|
|
156
158
|
}
|
|
157
159
|
|
|
158
|
-
.composer-mascot-active-idle[data-mascot-active-idle='rocket'][data-mascot-idle-phase='outbound'] .composer-mascot-
|
|
159
|
-
.composer-mascot-active-idle[data-mascot-active-idle='rocket'][data-mascot-idle-phase='inbound'] .composer-mascot-
|
|
160
|
+
.composer-mascot-active-idle[data-mascot-active-idle='rocket'][data-mascot-idle-phase='outbound'] .composer-mascot-trail::before,
|
|
161
|
+
.composer-mascot-active-idle[data-mascot-active-idle='rocket'][data-mascot-idle-phase='inbound'] .composer-mascot-trail::before {
|
|
160
162
|
content: '';
|
|
161
163
|
position: absolute;
|
|
162
164
|
top: 17px;
|
|
@@ -169,7 +171,8 @@
|
|
|
169
171
|
animation: composer-mascot-idle-rocket-trail 1.8s ease-out forwards;
|
|
170
172
|
}
|
|
171
173
|
|
|
172
|
-
|
|
174
|
+
/* The exhaust streams behind the leg's direction of travel. */
|
|
175
|
+
.composer-mascot-active-idle[data-mascot-active-idle='rocket'][data-mascot-idle-travel='left'] .composer-mascot-trail::before {
|
|
173
176
|
left: calc(100% - 2px);
|
|
174
177
|
background:
|
|
175
178
|
linear-gradient(90deg, #f5f7fa, #8fa5ff 28%, transparent 100%) 0 1px / 34px 2px no-repeat,
|
|
@@ -178,7 +181,7 @@
|
|
|
178
181
|
transform-origin: left center;
|
|
179
182
|
}
|
|
180
183
|
|
|
181
|
-
.composer-mascot-active-idle[data-mascot-active-idle='rocket'][data-mascot-idle-
|
|
184
|
+
.composer-mascot-active-idle[data-mascot-active-idle='rocket'][data-mascot-idle-travel='right'] .composer-mascot-trail::before {
|
|
182
185
|
right: calc(100% - 2px);
|
|
183
186
|
background:
|
|
184
187
|
linear-gradient(90deg, transparent 0%, #8fa5ff 72%, #f5f7fa 100%) 100% 1px / 34px 2px no-repeat,
|
|
@@ -224,77 +227,78 @@
|
|
|
224
227
|
86%, 100% { opacity: 0.7; transform: translateX(-50%) scaleX(1.12); }
|
|
225
228
|
}
|
|
226
229
|
|
|
227
|
-
.composer-mascot-active-idle[data-mascot-active-idle='hover'][data-mascot-idle-phase='outbound'] .composer-mascot-
|
|
228
|
-
--mascot-hover-x: -
|
|
230
|
+
.composer-mascot-active-idle[data-mascot-active-idle='hover'][data-mascot-idle-phase='outbound'] .composer-mascot-travel {
|
|
231
|
+
--mascot-hover-x: calc(200px * var(--mascot-idle-travel-sign, -1));
|
|
229
232
|
--mascot-hover-y: -128px;
|
|
230
233
|
animation: composer-mascot-idle-hover-rise-x 1.8s cubic-bezier(0.26, 0.55, 0.24, 1) forwards;
|
|
231
234
|
}
|
|
232
235
|
|
|
233
|
-
.composer-mascot-active-idle[data-mascot-active-idle='hover'][data-mascot-idle-phase='outbound'] .composer-mascot-
|
|
236
|
+
.composer-mascot-active-idle[data-mascot-active-idle='hover'][data-mascot-idle-phase='outbound'] .composer-mascot-lift {
|
|
234
237
|
animation: composer-mascot-idle-hover-rise-y 1.8s linear forwards;
|
|
235
238
|
}
|
|
236
239
|
|
|
237
|
-
.composer-mascot-active-idle[data-mascot-active-idle='hover'][data-mascot-idle-phase='away'] .composer-mascot-
|
|
240
|
+
.composer-mascot-active-idle[data-mascot-active-idle='hover'][data-mascot-idle-phase='away'] .composer-mascot-lift {
|
|
238
241
|
animation: composer-mascot-idle-hover-float 2.8s ease-in-out forwards;
|
|
239
242
|
}
|
|
240
243
|
|
|
241
|
-
.composer-mascot-active-idle[data-mascot-active-idle='hover'][data-mascot-idle-phase='inbound'] .composer-mascot-
|
|
242
|
-
--mascot-hover-x: 200px;
|
|
244
|
+
.composer-mascot-active-idle[data-mascot-active-idle='hover'][data-mascot-idle-phase='inbound'] .composer-mascot-travel {
|
|
245
|
+
--mascot-hover-x: calc(200px * var(--mascot-idle-travel-sign, -1));
|
|
243
246
|
--mascot-hover-y: 128px;
|
|
244
247
|
animation: composer-mascot-idle-hover-return-x 1.8s cubic-bezier(0.38, 0.04, 0.34, 1) forwards;
|
|
245
248
|
}
|
|
246
249
|
|
|
247
|
-
.composer-mascot-active-idle[data-mascot-active-idle='hover'][data-mascot-idle-phase='inbound'] .composer-mascot-
|
|
250
|
+
.composer-mascot-active-idle[data-mascot-active-idle='hover'][data-mascot-idle-phase='inbound'] .composer-mascot-lift {
|
|
248
251
|
animation: composer-mascot-idle-hover-return-y 1.8s linear forwards;
|
|
249
252
|
}
|
|
250
253
|
|
|
251
|
-
.composer-mascot-active-idle[data-mascot-active-idle='hover'][data-mascot-idle-phase='outbound'] .composer-mascot-
|
|
254
|
+
.composer-mascot-active-idle[data-mascot-active-idle='hover'][data-mascot-idle-phase='outbound'] .composer-mascot-body {
|
|
252
255
|
animation: composer-mascot-idle-hover-launch-body 1.8s ease-out forwards;
|
|
253
256
|
}
|
|
254
257
|
|
|
255
|
-
.composer-mascot-active-idle[data-mascot-active-idle='hover'][data-mascot-idle-phase='away'] .composer-mascot-
|
|
258
|
+
.composer-mascot-active-idle[data-mascot-active-idle='hover'][data-mascot-idle-phase='away'] .composer-mascot-body {
|
|
256
259
|
animation: composer-mascot-idle-hover-hold-body 2.8s ease-in-out forwards;
|
|
257
260
|
}
|
|
258
261
|
|
|
259
|
-
.composer-mascot-active-idle[data-mascot-active-idle='hover'][data-mascot-idle-phase='inbound'] .composer-mascot-
|
|
262
|
+
.composer-mascot-active-idle[data-mascot-active-idle='hover'][data-mascot-idle-phase='inbound'] .composer-mascot-body {
|
|
260
263
|
animation: composer-mascot-idle-hover-land-body 1.8s ease-in forwards;
|
|
261
264
|
}
|
|
262
265
|
|
|
263
|
-
.composer-mascot-active-idle[data-mascot-active-idle='hover'][data-mascot-idle-phase='away'] .composer-mascot-
|
|
266
|
+
.composer-mascot-active-idle[data-mascot-active-idle='hover'][data-mascot-idle-phase='away'] .composer-mascot-trail {
|
|
264
267
|
animation: composer-mascot-idle-hover-scan-body 2.8s ease-in-out forwards;
|
|
265
268
|
}
|
|
266
269
|
|
|
267
|
-
.composer-mascot-active-idle[data-mascot-active-idle='hover'] .composer-mascot-
|
|
270
|
+
.composer-mascot-active-idle[data-mascot-active-idle='hover'] .composer-mascot-trail {
|
|
268
271
|
position: relative;
|
|
269
272
|
isolation: isolate;
|
|
270
273
|
}
|
|
271
274
|
|
|
272
|
-
.composer-mascot-active-idle[data-mascot-active-idle='hover'] .composer-mascot-
|
|
275
|
+
.composer-mascot-active-idle[data-mascot-active-idle='hover'] .composer-mascot-trail::before {
|
|
273
276
|
content: '';
|
|
274
277
|
position: absolute;
|
|
275
278
|
top: 16px;
|
|
276
|
-
left: 40px;
|
|
277
279
|
z-index: 1;
|
|
278
280
|
width: 58px;
|
|
279
281
|
height: 32px;
|
|
282
|
+
opacity: 0;
|
|
283
|
+
pointer-events: none;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/* The side jet fires against the leg's direction of travel. */
|
|
287
|
+
.composer-mascot-active-idle[data-mascot-active-idle='hover'][data-mascot-idle-travel='left'] .composer-mascot-trail::before {
|
|
288
|
+
--mascot-idle-jet-tilt: 22deg;
|
|
289
|
+
left: 40px;
|
|
280
290
|
background:
|
|
281
291
|
linear-gradient(90deg, #f8fbff 0%, #9fb5ff 28%, transparent 94%) 0 3px / 42px 3px no-repeat,
|
|
282
292
|
linear-gradient(90deg, #f8fbff 0%, #7894f8 26%, transparent 96%) 0 14px / 58px 3px no-repeat,
|
|
283
293
|
linear-gradient(90deg, #dce6ff 0%, #6f8cf5 32%, transparent 94%) 0 25px / 34px 3px no-repeat;
|
|
284
294
|
filter: drop-shadow(6px 3px 5px color-mix(in srgb, #6f8dff 54%, transparent));
|
|
285
|
-
opacity: 0;
|
|
286
|
-
pointer-events: none;
|
|
287
295
|
transform: rotate(22deg) scaleX(0.18);
|
|
288
296
|
transform-origin: left center;
|
|
289
297
|
}
|
|
290
298
|
|
|
291
|
-
.composer-mascot-active-idle[data-mascot-active-idle='hover'][data-mascot-idle-
|
|
292
|
-
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
.composer-mascot-active-idle[data-mascot-active-idle='hover'][data-mascot-idle-phase='inbound'] .composer-mascot-jelly::before {
|
|
299
|
+
.composer-mascot-active-idle[data-mascot-active-idle='hover'][data-mascot-idle-travel='right'] .composer-mascot-trail::before {
|
|
300
|
+
--mascot-idle-jet-tilt: -18deg;
|
|
296
301
|
right: 40px;
|
|
297
|
-
left: auto;
|
|
298
302
|
background:
|
|
299
303
|
linear-gradient(90deg, transparent 6%, #9fb5ff 72%, #f8fbff 100%) 100% 3px / 42px 3px no-repeat,
|
|
300
304
|
linear-gradient(90deg, transparent 4%, #7894f8 74%, #f8fbff 100%) 100% 14px / 58px 3px no-repeat,
|
|
@@ -302,10 +306,17 @@
|
|
|
302
306
|
filter: drop-shadow(-5px 3px 5px color-mix(in srgb, #6f8dff 54%, transparent));
|
|
303
307
|
transform: rotate(-18deg) scaleX(0.18);
|
|
304
308
|
transform-origin: right center;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.composer-mascot-active-idle[data-mascot-active-idle='hover'][data-mascot-idle-phase='outbound'] .composer-mascot-trail::before {
|
|
312
|
+
animation: composer-mascot-idle-hover-side-jet-launch 1.8s ease-out forwards;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.composer-mascot-active-idle[data-mascot-active-idle='hover'][data-mascot-idle-phase='inbound'] .composer-mascot-trail::before {
|
|
305
316
|
animation: composer-mascot-idle-hover-side-jet-return 1.8s ease-out forwards;
|
|
306
317
|
}
|
|
307
318
|
|
|
308
|
-
.composer-mascot-active-idle[data-mascot-active-idle='hover'] .composer-mascot-
|
|
319
|
+
.composer-mascot-active-idle[data-mascot-active-idle='hover'] .composer-mascot-trail::after {
|
|
309
320
|
content: '';
|
|
310
321
|
position: absolute;
|
|
311
322
|
top: 46px;
|
|
@@ -327,15 +338,15 @@
|
|
|
327
338
|
transform-origin: top center;
|
|
328
339
|
}
|
|
329
340
|
|
|
330
|
-
.composer-mascot-active-idle[data-mascot-active-idle='hover'][data-mascot-idle-phase='outbound'] .composer-mascot-
|
|
341
|
+
.composer-mascot-active-idle[data-mascot-active-idle='hover'][data-mascot-idle-phase='outbound'] .composer-mascot-trail::after {
|
|
331
342
|
animation: composer-mascot-idle-hover-bottom-handoff 1.8s ease-out forwards;
|
|
332
343
|
}
|
|
333
344
|
|
|
334
|
-
.composer-mascot-active-idle[data-mascot-active-idle='hover'][data-mascot-idle-phase='away'] .composer-mascot-
|
|
345
|
+
.composer-mascot-active-idle[data-mascot-active-idle='hover'][data-mascot-idle-phase='away'] .composer-mascot-trail::after {
|
|
335
346
|
animation: composer-mascot-idle-hover-bottom-hold 360ms ease-in-out infinite;
|
|
336
347
|
}
|
|
337
348
|
|
|
338
|
-
.composer-mascot-active-idle[data-mascot-active-idle='hover'][data-mascot-idle-phase='inbound'] .composer-mascot-
|
|
349
|
+
.composer-mascot-active-idle[data-mascot-active-idle='hover'][data-mascot-idle-phase='inbound'] .composer-mascot-trail::after {
|
|
339
350
|
animation: composer-mascot-idle-hover-bottom-return 1.8s linear forwards;
|
|
340
351
|
}
|
|
341
352
|
|
|
@@ -373,9 +384,9 @@
|
|
|
373
384
|
@keyframes composer-mascot-idle-hover-launch-body {
|
|
374
385
|
0% { transform: translateY(0) scale(1); }
|
|
375
386
|
10% { transform: translateY(2px) scale(1.12, 0.82); }
|
|
376
|
-
22% { transform: translateY(-3px) rotate(-
|
|
377
|
-
72% { transform: translateY(-2px) rotate(-
|
|
378
|
-
90% { transform: translateY(1px) rotate(-
|
|
387
|
+
22% { transform: translateY(-3px) rotate(calc(8deg * var(--mascot-idle-travel-sign, -1))) scale(0.94, 1.09); }
|
|
388
|
+
72% { transform: translateY(-2px) rotate(calc(5deg * var(--mascot-idle-travel-sign, -1))) scale(0.98, 1.035); }
|
|
389
|
+
90% { transform: translateY(1px) rotate(calc(2deg * var(--mascot-idle-travel-sign, -1))) scale(1.02, 0.98); }
|
|
379
390
|
100% { transform: translateY(0) rotate(0) scale(1); }
|
|
380
391
|
}
|
|
381
392
|
|
|
@@ -387,8 +398,8 @@
|
|
|
387
398
|
|
|
388
399
|
@keyframes composer-mascot-idle-hover-land-body {
|
|
389
400
|
0% { transform: translateY(0) rotate(0) scale(1); }
|
|
390
|
-
18% { transform: translateY(-1px) rotate(5deg) scale(0.99, 1.02); }
|
|
391
|
-
66% { transform: translateY(-1px) rotate(3deg) scale(0.99, 1.02); }
|
|
401
|
+
18% { transform: translateY(-1px) rotate(calc(5deg * var(--mascot-idle-travel-sign, -1))) scale(0.99, 1.02); }
|
|
402
|
+
66% { transform: translateY(-1px) rotate(calc(3deg * var(--mascot-idle-travel-sign, -1))) scale(0.99, 1.02); }
|
|
392
403
|
86% { transform: translateY(0) rotate(0) scale(1); }
|
|
393
404
|
91% { transform: translateY(1px) rotate(0) scale(1.1, 0.88); }
|
|
394
405
|
95% { transform: translateY(-1px) rotate(0) scale(0.99, 1.02); }
|
|
@@ -402,19 +413,19 @@
|
|
|
402
413
|
}
|
|
403
414
|
|
|
404
415
|
@keyframes composer-mascot-idle-hover-side-jet-launch {
|
|
405
|
-
0% { opacity: 0.34; transform: rotate(22deg) scaleX(0.34); }
|
|
406
|
-
12% { opacity: 0.94; transform: rotate(22deg) scaleX(1.08); }
|
|
407
|
-
68% { opacity: 0.76; transform: rotate(22deg) scaleX(0.84); }
|
|
408
|
-
84% { opacity: 0.42; transform: rotate(22deg) scaleX(0.48); }
|
|
409
|
-
100% { opacity: 0; transform: rotate(22deg) scaleX(0.12); }
|
|
416
|
+
0% { opacity: 0.34; transform: rotate(var(--mascot-idle-jet-tilt, 22deg)) scaleX(0.34); }
|
|
417
|
+
12% { opacity: 0.94; transform: rotate(var(--mascot-idle-jet-tilt, 22deg)) scaleX(1.08); }
|
|
418
|
+
68% { opacity: 0.76; transform: rotate(var(--mascot-idle-jet-tilt, 22deg)) scaleX(0.84); }
|
|
419
|
+
84% { opacity: 0.42; transform: rotate(var(--mascot-idle-jet-tilt, 22deg)) scaleX(0.48); }
|
|
420
|
+
100% { opacity: 0; transform: rotate(var(--mascot-idle-jet-tilt, 22deg)) scaleX(0.12); }
|
|
410
421
|
}
|
|
411
422
|
|
|
412
423
|
@keyframes composer-mascot-idle-hover-side-jet-return {
|
|
413
|
-
0% { opacity: 0.28; transform: rotate(-18deg) scaleX(0.28); }
|
|
414
|
-
12% { opacity: 0.88; transform: rotate(-18deg) scaleX(0.92); }
|
|
415
|
-
52% { opacity: 0.66; transform: rotate(-18deg) scaleX(0.62); }
|
|
416
|
-
74% { opacity: 0.3; transform: rotate(-18deg) scaleX(0.34); }
|
|
417
|
-
86%, 100% { opacity: 0; transform: rotate(-18deg) scaleX(0.12); }
|
|
424
|
+
0% { opacity: 0.28; transform: rotate(var(--mascot-idle-jet-tilt, -18deg)) scaleX(0.28); }
|
|
425
|
+
12% { opacity: 0.88; transform: rotate(var(--mascot-idle-jet-tilt, -18deg)) scaleX(0.92); }
|
|
426
|
+
52% { opacity: 0.66; transform: rotate(var(--mascot-idle-jet-tilt, -18deg)) scaleX(0.62); }
|
|
427
|
+
74% { opacity: 0.3; transform: rotate(var(--mascot-idle-jet-tilt, -18deg)) scaleX(0.34); }
|
|
428
|
+
86%, 100% { opacity: 0; transform: rotate(var(--mascot-idle-jet-tilt, -18deg)) scaleX(0.12); }
|
|
418
429
|
}
|
|
419
430
|
|
|
420
431
|
@keyframes composer-mascot-idle-hover-bottom-handoff {
|
|
@@ -430,9 +441,9 @@
|
|
|
430
441
|
|
|
431
442
|
@keyframes composer-mascot-idle-hover-bottom-return {
|
|
432
443
|
0% { opacity: 0.78; transform: translateX(-50%) rotate(0) scaleY(0.72); animation-timing-function: ease-in-out; }
|
|
433
|
-
24% { opacity: 0.68; transform: translateX(-50%) rotate(8deg) scaleY(0.58); }
|
|
434
|
-
58% { opacity: 0.44; transform: translateX(-50%) rotate(7deg) scaleY(0.38); }
|
|
435
|
-
78% { opacity: 0.86; transform: translateX(-50%) rotate(3deg) scaleY(0.84); }
|
|
444
|
+
24% { opacity: 0.68; transform: translateX(-50%) rotate(calc(8deg * var(--mascot-idle-travel-sign, -1))) scaleY(0.58); }
|
|
445
|
+
58% { opacity: 0.44; transform: translateX(-50%) rotate(calc(7deg * var(--mascot-idle-travel-sign, -1))) scaleY(0.38); }
|
|
446
|
+
78% { opacity: 0.86; transform: translateX(-50%) rotate(calc(3deg * var(--mascot-idle-travel-sign, -1))) scaleY(0.84); }
|
|
436
447
|
91% { opacity: 0.98; transform: translateX(-50%) rotate(0) scaleY(1.04); }
|
|
437
448
|
100% { opacity: 0; transform: translateX(-50%) rotate(0) scaleY(0.14); }
|
|
438
449
|
}
|
|
@@ -14,6 +14,7 @@ interface ComposerAvatarBehaviorOptions {
|
|
|
14
14
|
activeIdle: boolean
|
|
15
15
|
bounceSignal: number
|
|
16
16
|
reducedMotion: boolean
|
|
17
|
+
directionalGestures?: boolean
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
export function useComposerAvatarBehavior(options: ComposerAvatarBehaviorOptions): {
|
|
@@ -60,7 +61,7 @@ export function useComposerAvatarBehavior(options: ComposerAvatarBehaviorOptions
|
|
|
60
61
|
: value < 0.86
|
|
61
62
|
? 'antenna-bob'
|
|
62
63
|
: undefined
|
|
63
|
-
if (next) {
|
|
64
|
+
if (next && (options.directionalGestures !== false || (next !== 'look-left' && next !== 'look-right'))) {
|
|
64
65
|
setGesture(next)
|
|
65
66
|
setGestureSequence((sequence) => sequence + 1)
|
|
66
67
|
}
|
|
@@ -70,7 +71,7 @@ export function useComposerAvatarBehavior(options: ComposerAvatarBehaviorOptions
|
|
|
70
71
|
}
|
|
71
72
|
schedule()
|
|
72
73
|
return () => { window.clearTimeout(timer) }
|
|
73
|
-
}, [options.sleeping, options.activeIdle, options.reducedMotion, options.baseExpression])
|
|
74
|
+
}, [options.sleeping, options.activeIdle, options.reducedMotion, options.baseExpression, options.directionalGestures])
|
|
74
75
|
|
|
75
76
|
const clearGesture = useCallback(() => setGesture(undefined), [])
|
|
76
77
|
const completeGesture = useCallback((sequence: number) => {
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef, useState, type AnimationEvent } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
MASCOT_ACTIVE_IDLE_ACTIVITY_THROTTLE_MS,
|
|
4
|
+
MASCOT_ACTIVE_IDLE_HOLD_MS,
|
|
5
|
+
MASCOT_ACTIVE_IDLE_JITTER_MS,
|
|
6
|
+
MASCOT_ACTIVE_IDLE_MIN_MS,
|
|
7
|
+
MASCOT_ACTIVE_IDLE_TRAVEL_MS,
|
|
8
|
+
pickMascotActiveIdle,
|
|
9
|
+
type MascotActiveIdle,
|
|
10
|
+
type MascotActiveIdleMotion,
|
|
11
|
+
type MascotActiveIdlePhase,
|
|
12
|
+
type MascotActiveIdlePlan,
|
|
13
|
+
type MascotIdleDirection
|
|
14
|
+
} from './constants.js'
|
|
15
|
+
|
|
16
|
+
export interface MascotActiveIdleAttributes {
|
|
17
|
+
'data-mascot-active-idle'?: MascotActiveIdleMotion
|
|
18
|
+
'data-mascot-idle-phase'?: MascotActiveIdlePhase
|
|
19
|
+
'data-mascot-idle-direction'?: MascotIdleDirection
|
|
20
|
+
'data-mascot-idle-travel'?: MascotIdleDirection
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface MascotActiveIdleOptions {
|
|
24
|
+
/** True while the character is free to wander: idle, awake, unfocused, and motion allowed. */
|
|
25
|
+
enabled: boolean
|
|
26
|
+
onStart?: () => void
|
|
27
|
+
/** Runs on user activity, before the schedule-reset throttle. */
|
|
28
|
+
onActivity?: () => void
|
|
29
|
+
/** Decides direction and motion pool at launch; `null` skips this round. */
|
|
30
|
+
plan?: () => MascotActiveIdlePlan | null
|
|
31
|
+
/** Whether pointer movement aborts a trip in flight; it always defers the next one. */
|
|
32
|
+
interruptOnPointerMove?: boolean
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface MascotActiveIdleHandle {
|
|
36
|
+
activeIdle: MascotActiveIdle | null
|
|
37
|
+
activityRevision: number
|
|
38
|
+
className: 'composer-mascot-active-idle' | undefined
|
|
39
|
+
attributes: MascotActiveIdleAttributes
|
|
40
|
+
cancel: () => void
|
|
41
|
+
onAnimationEnd: (event: AnimationEvent<Element>) => void
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const RETRY_MS = 5000
|
|
45
|
+
const LEG_SETTLE_MS = 160
|
|
46
|
+
|
|
47
|
+
function opposite(direction: MascotIdleDirection): MascotIdleDirection {
|
|
48
|
+
return direction === 'left' ? 'right' : 'left'
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function finisherOf(trip: MascotActiveIdle): string {
|
|
52
|
+
if (trip.motion === 'hop') return 'composer-mascot-idle-hop-travel'
|
|
53
|
+
if (trip.motion === 'rocket') return 'composer-mascot-idle-rocket-flight-x'
|
|
54
|
+
return trip.phase === 'outbound' ? 'composer-mascot-idle-hover-launch-body' : 'composer-mascot-idle-hover-land-body'
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function advance(trip: MascotActiveIdle | null): MascotActiveIdle | null {
|
|
58
|
+
if (!trip) return null
|
|
59
|
+
if (trip.phase === 'outbound') return { ...trip, phase: 'away' }
|
|
60
|
+
if (trip.phase === 'away') return { ...trip, phase: 'inbound', travel: opposite(trip.direction) }
|
|
61
|
+
return null
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Schedules the traveling idle antics (hop, rocket, hover) after a quiet stretch. Any host that
|
|
66
|
+
* renders the stage classes (see MascotIdleStage) can spread the returned attributes on its root.
|
|
67
|
+
*/
|
|
68
|
+
export function useMascotActiveIdle(options: MascotActiveIdleOptions): MascotActiveIdleHandle {
|
|
69
|
+
const { enabled, interruptOnPointerMove = true } = options
|
|
70
|
+
const [activeIdle, setActiveIdle] = useState<MascotActiveIdle | null>(null)
|
|
71
|
+
const [activityRevision, setActivityRevision] = useState(0)
|
|
72
|
+
const optionsRef = useRef(options)
|
|
73
|
+
optionsRef.current = options
|
|
74
|
+
const activeRef = useRef(activeIdle)
|
|
75
|
+
activeRef.current = activeIdle
|
|
76
|
+
const lastActivityRef = useRef(0)
|
|
77
|
+
const lastMotionRef = useRef<MascotActiveIdleMotion | null>(null)
|
|
78
|
+
|
|
79
|
+
const cancel = useCallback(() => setActiveIdle(null), [])
|
|
80
|
+
|
|
81
|
+
const markActivity = useCallback((interrupt: boolean) => {
|
|
82
|
+
if (interrupt) setActiveIdle(null)
|
|
83
|
+
optionsRef.current.onActivity?.()
|
|
84
|
+
const now = Date.now()
|
|
85
|
+
if (now - lastActivityRef.current < MASCOT_ACTIVE_IDLE_ACTIVITY_THROTTLE_MS) return
|
|
86
|
+
lastActivityRef.current = now
|
|
87
|
+
setActivityRevision((value) => value + 1)
|
|
88
|
+
}, [])
|
|
89
|
+
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
const interrupt = (): void => markActivity(true)
|
|
92
|
+
const pointerMove = (): void => {
|
|
93
|
+
if (Date.now() - lastActivityRef.current >= MASCOT_ACTIVE_IDLE_ACTIVITY_THROTTLE_MS) {
|
|
94
|
+
markActivity(interruptOnPointerMove)
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
window.addEventListener('keydown', interrupt)
|
|
98
|
+
window.addEventListener('pointerdown', interrupt)
|
|
99
|
+
window.addEventListener('pointermove', pointerMove, { passive: true })
|
|
100
|
+
window.addEventListener('wheel', interrupt, { passive: true })
|
|
101
|
+
window.addEventListener('focusin', interrupt)
|
|
102
|
+
return () => {
|
|
103
|
+
window.removeEventListener('keydown', interrupt)
|
|
104
|
+
window.removeEventListener('pointerdown', interrupt)
|
|
105
|
+
window.removeEventListener('pointermove', pointerMove)
|
|
106
|
+
window.removeEventListener('wheel', interrupt)
|
|
107
|
+
window.removeEventListener('focusin', interrupt)
|
|
108
|
+
}
|
|
109
|
+
}, [markActivity, interruptOnPointerMove])
|
|
110
|
+
|
|
111
|
+
useEffect(() => {
|
|
112
|
+
if (!enabled) {
|
|
113
|
+
setActiveIdle(null)
|
|
114
|
+
return undefined
|
|
115
|
+
}
|
|
116
|
+
let timer = 0
|
|
117
|
+
const wait = (): number => MASCOT_ACTIVE_IDLE_MIN_MS + Math.random() * MASCOT_ACTIVE_IDLE_JITTER_MS
|
|
118
|
+
const start = (): void => {
|
|
119
|
+
if (document.hidden || activeRef.current) {
|
|
120
|
+
timer = window.setTimeout(start, RETRY_MS)
|
|
121
|
+
return
|
|
122
|
+
}
|
|
123
|
+
const plan = optionsRef.current.plan?.()
|
|
124
|
+
if (plan === null) {
|
|
125
|
+
timer = window.setTimeout(start, wait())
|
|
126
|
+
return
|
|
127
|
+
}
|
|
128
|
+
const motion = pickMascotActiveIdle(Math.random(), lastMotionRef.current, plan?.motions)
|
|
129
|
+
lastMotionRef.current = motion
|
|
130
|
+
optionsRef.current.onStart?.()
|
|
131
|
+
const direction = plan?.direction ?? 'left'
|
|
132
|
+
setActiveIdle({ motion, phase: 'outbound', direction, travel: direction })
|
|
133
|
+
}
|
|
134
|
+
timer = window.setTimeout(start, wait())
|
|
135
|
+
return () => window.clearTimeout(timer)
|
|
136
|
+
}, [enabled, activityRevision])
|
|
137
|
+
|
|
138
|
+
useEffect(() => {
|
|
139
|
+
if (!activeIdle) return undefined
|
|
140
|
+
const delay = activeIdle.phase === 'away'
|
|
141
|
+
? MASCOT_ACTIVE_IDLE_HOLD_MS[activeIdle.motion]
|
|
142
|
+
: MASCOT_ACTIVE_IDLE_TRAVEL_MS[activeIdle.motion] + LEG_SETTLE_MS
|
|
143
|
+
const timer = window.setTimeout(() => setActiveIdle(advance), delay)
|
|
144
|
+
return () => window.clearTimeout(timer)
|
|
145
|
+
}, [activeIdle])
|
|
146
|
+
|
|
147
|
+
const onAnimationEnd = useCallback((event: AnimationEvent<Element>) => {
|
|
148
|
+
setActiveIdle((current) => {
|
|
149
|
+
if (!current || event.animationName !== finisherOf(current)) return current
|
|
150
|
+
return current.phase === 'outbound' ? { ...current, phase: 'away' } : null
|
|
151
|
+
})
|
|
152
|
+
}, [])
|
|
153
|
+
|
|
154
|
+
const attributes: MascotActiveIdleAttributes = activeIdle
|
|
155
|
+
? {
|
|
156
|
+
'data-mascot-active-idle': activeIdle.motion,
|
|
157
|
+
'data-mascot-idle-phase': activeIdle.phase,
|
|
158
|
+
'data-mascot-idle-direction': activeIdle.direction,
|
|
159
|
+
'data-mascot-idle-travel': activeIdle.travel
|
|
160
|
+
}
|
|
161
|
+
: {}
|
|
162
|
+
return {
|
|
163
|
+
activeIdle,
|
|
164
|
+
activityRevision,
|
|
165
|
+
className: activeIdle ? 'composer-mascot-active-idle' : undefined,
|
|
166
|
+
attributes,
|
|
167
|
+
cancel,
|
|
168
|
+
onAnimationEnd
|
|
169
|
+
}
|
|
170
|
+
}
|
package/src/react.ts
CHANGED
|
@@ -4,3 +4,8 @@ export { DecorationSwatch, PrimaryDecoration, SecondaryDecoration } from './Deco
|
|
|
4
4
|
export { ComposerMascot } from './composer/ComposerMascot.js'
|
|
5
5
|
export type { ComposerMascotProps, ComposerMascotContext, MascotExpression, MascotLight } from './composer/types.js'
|
|
6
6
|
export { ComposerMascotShadow } from './composer/ComposerMascotShadow.js'
|
|
7
|
+
export { useComposerAvatarBehavior } from './composer/useComposerAvatarBehavior.js'
|
|
8
|
+
export { useMascotActiveIdle, type MascotActiveIdleAttributes, type MascotActiveIdleHandle, type MascotActiveIdleOptions } from './composer/useMascotActiveIdle.js'
|
|
9
|
+
export { MascotIdleStage } from './composer/MascotIdleStage.js'
|
|
10
|
+
export { MASCOT_SLEEP_AFTER_MS } from './composer/constants.js'
|
|
11
|
+
export type { MascotActiveIdle, MascotActiveIdleMotion, MascotActiveIdlePhase, MascotActiveIdlePlan, MascotIdleDirection } from './composer/constants.js'
|