@mumulinya167/ccm-pet-assets 2.0.0
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/README.md +4 -0
- package/assets/calico/calico-collapsing.apng +0 -0
- package/assets/calico/calico-dozing.apng +0 -0
- package/assets/calico/calico-error.apng +0 -0
- package/assets/calico/calico-happy.apng +0 -0
- package/assets/calico/calico-idle-follow.svg +324 -0
- package/assets/calico/calico-idle.apng +0 -0
- package/assets/calico/calico-mini-alert.apng +0 -0
- package/assets/calico/calico-mini-crabwalk.apng +0 -0
- package/assets/calico/calico-mini-enter.apng +0 -0
- package/assets/calico/calico-mini-happy.apng +0 -0
- package/assets/calico/calico-mini-idle.apng +0 -0
- package/assets/calico/calico-mini-peek.apng +0 -0
- package/assets/calico/calico-mini-sleep.apng +0 -0
- package/assets/calico/calico-notification.apng +0 -0
- package/assets/calico/calico-react-drag.apng +0 -0
- package/assets/calico/calico-react-left.apng +0 -0
- package/assets/calico/calico-react-poke.apng +0 -0
- package/assets/calico/calico-sleeping.apng +0 -0
- package/assets/calico/calico-thinking.apng +0 -0
- package/assets/calico/calico-waking.apng +0 -0
- package/assets/calico/calico-working-building.apng +0 -0
- package/assets/calico/calico-working-carrying.apng +0 -0
- package/assets/calico/calico-working-conducting.apng +0 -0
- package/assets/calico/calico-working-juggling.apng +0 -0
- package/assets/calico/calico-working-sweeping.apng +0 -0
- package/assets/calico/calico-working-typing.apng +0 -0
- package/assets/calico/calico-yawning.apng +0 -0
- package/assets/calico.svg +324 -0
- package/assets/clawd/LICENSE +22 -0
- package/assets/clawd/clawd-about-hero.svg +202 -0
- package/assets/clawd/clawd-collapse-sleep.svg +247 -0
- package/assets/clawd/clawd-error.svg +94 -0
- package/assets/clawd/clawd-happy.svg +161 -0
- package/assets/clawd/clawd-headphones-groove.svg +194 -0
- package/assets/clawd/clawd-idle-bubble.svg +180 -0
- package/assets/clawd/clawd-idle-collapse.svg +101 -0
- package/assets/clawd/clawd-idle-doze.svg +72 -0
- package/assets/clawd/clawd-idle-follow.svg +64 -0
- package/assets/clawd/clawd-idle-living.svg +196 -0
- package/assets/clawd/clawd-idle-look.svg +115 -0
- package/assets/clawd/clawd-idle-reading.svg +252 -0
- package/assets/clawd/clawd-idle-yawn.svg +158 -0
- package/assets/clawd/clawd-mini-alert.svg +129 -0
- package/assets/clawd/clawd-mini-crabwalk.svg +76 -0
- package/assets/clawd/clawd-mini-enter-sleep.svg +64 -0
- package/assets/clawd/clawd-mini-enter.svg +114 -0
- package/assets/clawd/clawd-mini-happy.svg +124 -0
- package/assets/clawd/clawd-mini-idle.svg +83 -0
- package/assets/clawd/clawd-mini-peek.svg +82 -0
- package/assets/clawd/clawd-mini-sleep.svg +112 -0
- package/assets/clawd/clawd-mini-typing.svg +153 -0
- package/assets/clawd/clawd-notification.svg +438 -0
- package/assets/clawd/clawd-react-annoyed.svg +167 -0
- package/assets/clawd/clawd-react-double-jump.svg +229 -0
- package/assets/clawd/clawd-react-double.svg +108 -0
- package/assets/clawd/clawd-react-drag.svg +102 -0
- package/assets/clawd/clawd-react-left.svg +102 -0
- package/assets/clawd/clawd-react-right.svg +102 -0
- package/assets/clawd/clawd-sleeping.svg +118 -0
- package/assets/clawd/clawd-static-base.svg +21 -0
- package/assets/clawd/clawd-wake.svg +277 -0
- package/assets/clawd/clawd-working-building.svg +329 -0
- package/assets/clawd/clawd-working-carrying.svg +178 -0
- package/assets/clawd/clawd-working-debugger.svg +245 -0
- package/assets/clawd/clawd-working-juggling.svg +183 -0
- package/assets/clawd/clawd-working-sweeping.svg +248 -0
- package/assets/clawd/clawd-working-thinking.svg +501 -0
- package/assets/clawd/clawd-working-typing-boss.svg +307 -0
- package/assets/clawd/clawd-working-typing.svg +273 -0
- package/assets/clawd/clawd-working-ultrathink.svg +166 -0
- package/assets/clawd/clawd-working-wizard.svg +356 -0
- package/assets/clawd.svg +64 -0
- package/assets/cloudling/cloudling/cloudling-attention.svg +380 -0
- package/assets/cloudling/cloudling/cloudling-building.svg +667 -0
- package/assets/cloudling/cloudling/cloudling-carrying.svg +604 -0
- package/assets/cloudling/cloudling/cloudling-conducting.svg +616 -0
- package/assets/cloudling/cloudling/cloudling-dozing-to-sleeping.svg +578 -0
- package/assets/cloudling/cloudling/cloudling-dozing.svg +358 -0
- package/assets/cloudling/cloudling/cloudling-error.svg +428 -0
- package/assets/cloudling/cloudling/cloudling-idle-reading.svg +658 -0
- package/assets/cloudling/cloudling/cloudling-idle-to-dozing.svg +568 -0
- package/assets/cloudling/cloudling/cloudling-idle-to-sleeping.svg +811 -0
- package/assets/cloudling/cloudling/cloudling-idle.svg +255 -0
- package/assets/cloudling/cloudling/cloudling-juggling.svg +648 -0
- package/assets/cloudling/cloudling/cloudling-mini-alert.svg +390 -0
- package/assets/cloudling/cloudling/cloudling-mini-crabwalk.svg +335 -0
- package/assets/cloudling/cloudling/cloudling-mini-enter-roll-in.svg +226 -0
- package/assets/cloudling/cloudling/cloudling-mini-enter-sleep.svg +232 -0
- package/assets/cloudling/cloudling/cloudling-mini-happy.svg +371 -0
- package/assets/cloudling/cloudling/cloudling-mini-idle.svg +279 -0
- package/assets/cloudling/cloudling/cloudling-mini-peek.svg +328 -0
- package/assets/cloudling/cloudling/cloudling-mini-sleep.svg +260 -0
- package/assets/cloudling/cloudling/cloudling-mini-typing.svg +692 -0
- package/assets/cloudling/cloudling/cloudling-notification.svg +494 -0
- package/assets/cloudling/cloudling/cloudling-react-drag.svg +83 -0
- package/assets/cloudling/cloudling/cloudling-sleeping-to-idle.svg +555 -0
- package/assets/cloudling/cloudling/cloudling-sleeping.svg +500 -0
- package/assets/cloudling/cloudling/cloudling-sweeping.svg +292 -0
- package/assets/cloudling/cloudling/cloudling-thinking.svg +720 -0
- package/assets/cloudling/cloudling/cloudling-typing.svg +354 -0
- package/assets/cloudling/cloudling-attention.svg +380 -0
- package/assets/cloudling/cloudling-building.svg +667 -0
- package/assets/cloudling/cloudling-carrying.svg +604 -0
- package/assets/cloudling/cloudling-conducting.svg +616 -0
- package/assets/cloudling/cloudling-dozing-to-sleeping.svg +578 -0
- package/assets/cloudling/cloudling-dozing.svg +358 -0
- package/assets/cloudling/cloudling-error.svg +428 -0
- package/assets/cloudling/cloudling-idle-reading.svg +658 -0
- package/assets/cloudling/cloudling-idle-to-dozing.svg +568 -0
- package/assets/cloudling/cloudling-idle-to-sleeping.svg +811 -0
- package/assets/cloudling/cloudling-idle.svg +255 -0
- package/assets/cloudling/cloudling-juggling.svg +648 -0
- package/assets/cloudling/cloudling-mini-alert.svg +390 -0
- package/assets/cloudling/cloudling-mini-crabwalk.svg +335 -0
- package/assets/cloudling/cloudling-mini-enter-roll-in.svg +226 -0
- package/assets/cloudling/cloudling-mini-enter-sleep.svg +232 -0
- package/assets/cloudling/cloudling-mini-happy.svg +371 -0
- package/assets/cloudling/cloudling-mini-idle.svg +279 -0
- package/assets/cloudling/cloudling-mini-peek.svg +328 -0
- package/assets/cloudling/cloudling-mini-sleep.svg +260 -0
- package/assets/cloudling/cloudling-mini-typing.svg +692 -0
- package/assets/cloudling/cloudling-notification.svg +494 -0
- package/assets/cloudling/cloudling-react-drag.svg +83 -0
- package/assets/cloudling/cloudling-sleeping-to-idle.svg +555 -0
- package/assets/cloudling/cloudling-sleeping.svg +500 -0
- package/assets/cloudling/cloudling-sweeping.svg +292 -0
- package/assets/cloudling/cloudling-thinking.svg +720 -0
- package/assets/cloudling/cloudling-typing.svg +354 -0
- package/assets/cloudling.svg +255 -0
- package/assets/ghost-attention.svg +19 -0
- package/assets/ghost-carrying.svg +19 -0
- package/assets/ghost-collapsing.svg +19 -0
- package/assets/ghost-dozing.svg +23 -0
- package/assets/ghost-error.svg +19 -0
- package/assets/ghost-happy.svg +23 -0
- package/assets/ghost-idle-action1.svg +19 -0
- package/assets/ghost-idle-action2.svg +19 -0
- package/assets/ghost-idle-action3.svg +19 -0
- package/assets/ghost-idle.svg +11 -0
- package/assets/ghost-juggling.svg +19 -0
- package/assets/ghost-notification.svg +19 -0
- package/assets/ghost-react-double.svg +23 -0
- package/assets/ghost-react-drag.svg +23 -0
- package/assets/ghost-react-left.svg +19 -0
- package/assets/ghost-react-right.svg +19 -0
- package/assets/ghost-sleeping.svg +19 -0
- package/assets/ghost-sweeping.svg +19 -0
- package/assets/ghost-thinking.svg +19 -0
- package/assets/ghost-waking.svg +19 -0
- package/assets/ghost-working.svg +19 -0
- package/assets/ghost-yawning.svg +23 -0
- package/assets/ghost.svg +11 -0
- package/assets/robot-attention.svg +19 -0
- package/assets/robot-carrying.svg +19 -0
- package/assets/robot-collapsing.svg +19 -0
- package/assets/robot-dozing.svg +23 -0
- package/assets/robot-error.svg +19 -0
- package/assets/robot-happy.svg +23 -0
- package/assets/robot-idle-action1.svg +19 -0
- package/assets/robot-idle-action2.svg +19 -0
- package/assets/robot-idle-action3.svg +19 -0
- package/assets/robot-idle.svg +11 -0
- package/assets/robot-juggling.svg +19 -0
- package/assets/robot-notification.svg +19 -0
- package/assets/robot-react-double.svg +23 -0
- package/assets/robot-react-drag.svg +23 -0
- package/assets/robot-react-left.svg +19 -0
- package/assets/robot-react-right.svg +19 -0
- package/assets/robot-sleeping.svg +19 -0
- package/assets/robot-sweeping.svg +19 -0
- package/assets/robot-thinking.svg +19 -0
- package/assets/robot-waking.svg +19 -0
- package/assets/robot-working.svg +19 -0
- package/assets/robot-yawning.svg +23 -0
- package/assets/robot.svg +11 -0
- package/manifest.json +889 -0
- package/package.json +18 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
<svg id="cloudling" xmlns="http://www.w3.org/2000/svg" width="480" height="480" viewBox="-12 -12 48 48" preserveAspectRatio="xMidYMid meet">
|
|
2
|
+
<style><![CDATA[
|
|
3
|
+
.v {
|
|
4
|
+
text-align: right;
|
|
5
|
+
font: 600 10px ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
6
|
+
color: #7A9DFF;
|
|
7
|
+
}
|
|
8
|
+
.edge-rim-tight { stroke-opacity: .65; }
|
|
9
|
+
.edge-rim-soft { stroke-opacity: .50; }
|
|
10
|
+
.edge-contact { stroke-opacity: .65; }
|
|
11
|
+
.duration-probe {
|
|
12
|
+
opacity: 0;
|
|
13
|
+
animation: mini-enter-sleep-duration-probe 1.45s linear 1 both;
|
|
14
|
+
}
|
|
15
|
+
@keyframes mini-enter-sleep-duration-probe {
|
|
16
|
+
from { transform: translateX(0); }
|
|
17
|
+
to { transform: translateX(0); }
|
|
18
|
+
}
|
|
19
|
+
@media (prefers-color-scheme: light) {
|
|
20
|
+
.v { color: #3941FF; }
|
|
21
|
+
.edge-rim-tight { stroke-opacity: .75; }
|
|
22
|
+
.edge-rim-soft { stroke-opacity: .60; }
|
|
23
|
+
.edge-contact { stroke-opacity: .75; }
|
|
24
|
+
.cloud-drop-shadow { flood-opacity: .13; }
|
|
25
|
+
.food-cloud-shadow { flood-opacity: .28; flood-color: #5060FF; }
|
|
26
|
+
.food-cloud > path {
|
|
27
|
+
stroke: #5870E8 !important;
|
|
28
|
+
stroke-width: 1.2 !important;
|
|
29
|
+
stroke-opacity: .9 !important;
|
|
30
|
+
vector-effect: non-scaling-stroke !important;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
]]></style>
|
|
34
|
+
<defs>
|
|
35
|
+
<linearGradient id="body-grad" x1="12" y1="2" x2="12" y2="22" gradientUnits="userSpaceOnUse">
|
|
36
|
+
<stop offset="0" stop-color="#f0f9ff"/>
|
|
37
|
+
<stop offset="0.5" stop-color="#e0f2fe"/>
|
|
38
|
+
<stop offset="1" stop-color="#bae6fd"/>
|
|
39
|
+
</linearGradient>
|
|
40
|
+
<linearGradient id="eye-grad" x1="12" y1="3" x2="12" y2="21" gradientUnits="userSpaceOnUse">
|
|
41
|
+
<stop offset="0" stop-color="#B1A7FF"/>
|
|
42
|
+
<stop offset="0.5" stop-color="#7A9DFF"/>
|
|
43
|
+
<stop offset="1" stop-color="#3941FF"/>
|
|
44
|
+
</linearGradient>
|
|
45
|
+
<radialGradient id="hi-grad" cx="0.45" cy="0.25" r="0.55">
|
|
46
|
+
<stop offset="0" stop-color="#f0f9ff" stop-opacity="0.9"/>
|
|
47
|
+
<stop offset="1" stop-color="#f0f9ff" stop-opacity="0"/>
|
|
48
|
+
</radialGradient>
|
|
49
|
+
<filter id="drop" x="-40%" y="-40%" width="180%" height="180%">
|
|
50
|
+
<feDropShadow class="cloud-drop-shadow" dx="0" dy="0.55" stdDeviation="0.72" flood-color="#3941FF" flood-opacity="0.17"/>
|
|
51
|
+
</filter>
|
|
52
|
+
<filter id="edge-blur" x="-40%" y="-40%" width="180%" height="180%">
|
|
53
|
+
<feGaussianBlur stdDeviation="0.16"/>
|
|
54
|
+
</filter>
|
|
55
|
+
<path id="cloud-shape" d="M9.064 3.344a4.578 4.578 0 012.285-.312c1 .115 1.891.54 2.673 1.275.01.01.024.017.037.021a.09.09 0 00.043 0 4.55 4.55 0 013.046.275l.047.022.116.057a4.581 4.581 0 012.188 2.399c.209.51.313 1.041.315 1.595a4.24 4.24 0 01-.134 1.223.123.123 0 00.03.115c.594.607.988 1.33 1.183 2.17.289 1.425-.007 2.71-.887 3.854l-.136.166a4.548 4.548 0 01-2.201 1.388.123.123 0 00-.081.076c-.191.551-.383 1.023-.74 1.494-.9 1.187-2.222 1.846-3.711 1.838-1.187-.006-2.239-.44-3.157-1.302a.107.107 0 00-.105-.024c-.388.125-.78.143-1.204.138a4.441 4.441 0 01-1.945-.466 4.544 4.544 0 01-1.61-1.335c-.152-.202-.303-.392-.414-.617a5.81 5.81 0 01-.37-.961 4.582 4.582 0 01-.014-2.298.124.124 0 00.006-.056.085.085 0 00-.027-.048 4.467 4.467 0 01-1.034-1.651 3.896 3.896 0 01-.251-1.192 5.189 5.189 0 01.141-1.6c.337-1.112.982-1.985 1.933-2.618.212-.141.413-.251.601-.33.215-.089.43-.164.646-.227a.098.098 0 00.065-.066 4.51 4.51 0 01.829-1.615 4.535 4.535 0 011.837-1.388z"/>
|
|
56
|
+
<clipPath id="cloud-clip">
|
|
57
|
+
<use href="#cloud-shape"/>
|
|
58
|
+
</clipPath>
|
|
59
|
+
</defs>
|
|
60
|
+
|
|
61
|
+
<rect x="-12" y="-12" width="48" height="48" fill="transparent"/>
|
|
62
|
+
<rect class="duration-probe" x="-12" y="-12" width="0.01" height="0.01" fill="transparent"/>
|
|
63
|
+
|
|
64
|
+
<g id="enter-js">
|
|
65
|
+
<g id="body-js">
|
|
66
|
+
<g id="breath-js">
|
|
67
|
+
<g id="edge-system">
|
|
68
|
+
<use class="edge-contact" href="#cloud-shape" fill="none" stroke="#7d8aa7" stroke-width="1.00" stroke-linejoin="round" transform="translate(0 .18)" filter="url(#edge-blur)"/>
|
|
69
|
+
<use class="edge-rim-soft" href="#cloud-shape" fill="none" stroke="#7A9DFF" stroke-width=".84" stroke-linejoin="round" filter="url(#edge-blur)"/>
|
|
70
|
+
<use class="edge-rim-tight" href="#cloud-shape" fill="none" stroke="#aab3c6" stroke-width=".38" stroke-linejoin="round"/>
|
|
71
|
+
</g>
|
|
72
|
+
<g filter="url(#drop)">
|
|
73
|
+
<use href="#cloud-shape" fill="url(#body-grad)"/>
|
|
74
|
+
<rect x="1" y="2" width="22" height="11" fill="url(#hi-grad)" clip-path="url(#cloud-clip)"/>
|
|
75
|
+
</g>
|
|
76
|
+
</g>
|
|
77
|
+
</g>
|
|
78
|
+
<g id="eyes-js">
|
|
79
|
+
<g id="blink-js">
|
|
80
|
+
<path id="eye-l" class="eye" fill="none" stroke="url(#eye-grad)" stroke-width="0.72" stroke-linecap="round" stroke-linejoin="round"/>
|
|
81
|
+
<path id="eye-r" class="eye" fill="none" stroke="url(#eye-grad)" stroke-width="0.72" stroke-linecap="round" stroke-linejoin="round"/>
|
|
82
|
+
</g>
|
|
83
|
+
</g>
|
|
84
|
+
</g>
|
|
85
|
+
<g id="__cloudling-export-shims" opacity="0" pointer-events="none" style="display:none">
|
|
86
|
+
<g id="pose-readout"></g>
|
|
87
|
+
<g id="progress-readout"></g>
|
|
88
|
+
</g>
|
|
89
|
+
|
|
90
|
+
<script type="application/ecmascript"><![CDATA[
|
|
91
|
+
const svg = document.getElementById("cloudling");
|
|
92
|
+
const enter = document.getElementById("enter-js");
|
|
93
|
+
const eyeGrad = document.getElementById("eye-grad");
|
|
94
|
+
const eyeL = document.getElementById("eye-l");
|
|
95
|
+
const eyeR = document.getElementById("eye-r");
|
|
96
|
+
const progressReadout = document.getElementById("progress-readout");
|
|
97
|
+
const poseReadout = document.getElementById("pose-readout");
|
|
98
|
+
|
|
99
|
+
const EYE_BASE = {
|
|
100
|
+
l: { cx: 7.75, cy: 12.02, w: 2.58, h: 1.18, tilt: -6.0 },
|
|
101
|
+
r: { cx: 12.15, cy: 12.02, w: 2.58, h: 1.18, tilt: 6.0 },
|
|
102
|
+
};
|
|
103
|
+
const params = {
|
|
104
|
+
duration: 1.45,
|
|
105
|
+
startX: 15.8,
|
|
106
|
+
rollDeg: 8,
|
|
107
|
+
overshoot: 0.55,
|
|
108
|
+
squash: 0.035,
|
|
109
|
+
eyeDrop: 0.12,
|
|
110
|
+
};
|
|
111
|
+
let startT = performance.now();
|
|
112
|
+
let playing = true;
|
|
113
|
+
let heldProgress = 0;
|
|
114
|
+
let lastState = null;
|
|
115
|
+
|
|
116
|
+
function clamp(v, min, max) {
|
|
117
|
+
return Math.max(min, Math.min(max, v));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function lerp(a, b, t) {
|
|
121
|
+
return a + (b - a) * t;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function smoothstep(edge0, edge1, x) {
|
|
125
|
+
const t = clamp((x - edge0) / Math.max(edge1 - edge0, 0.0001), 0, 1);
|
|
126
|
+
return t * t * (3 - 2 * t);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function easeOutCubic(t) {
|
|
130
|
+
return 1 - Math.pow(1 - t, 3);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function sampleKeyframes(p, frames) {
|
|
134
|
+
if (p <= frames[0].p) return frames[0].v;
|
|
135
|
+
for (let i = 1; i < frames.length; i++) {
|
|
136
|
+
const prev = frames[i - 1];
|
|
137
|
+
const next = frames[i];
|
|
138
|
+
if (p <= next.p) {
|
|
139
|
+
const t = smoothstep(prev.p, next.p, p);
|
|
140
|
+
return lerp(prev.v, next.v, t);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return frames[frames.length - 1].v;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function stateAt(p) {
|
|
147
|
+
const bodyP = smoothstep(0.08, 1.0, p);
|
|
148
|
+
const tx = sampleKeyframes(p, [
|
|
149
|
+
{ p: 0.00, v: params.startX },
|
|
150
|
+
{ p: 0.08, v: params.startX },
|
|
151
|
+
{ p: 0.50, v: -params.overshoot },
|
|
152
|
+
{ p: 0.68, v: params.overshoot * 0.32 },
|
|
153
|
+
{ p: 0.84, v: -params.overshoot * 0.10 },
|
|
154
|
+
{ p: 1.00, v: 0 },
|
|
155
|
+
]);
|
|
156
|
+
const rot = sampleKeyframes(p, [
|
|
157
|
+
{ p: 0.00, v: params.rollDeg },
|
|
158
|
+
{ p: 0.08, v: params.rollDeg },
|
|
159
|
+
{ p: 0.50, v: -params.rollDeg * 0.22 },
|
|
160
|
+
{ p: 0.68, v: params.rollDeg * 0.08 },
|
|
161
|
+
{ p: 0.84, v: -params.rollDeg * 0.03 },
|
|
162
|
+
{ p: 1.00, v: 0 },
|
|
163
|
+
]);
|
|
164
|
+
const ty = sampleKeyframes(p, [
|
|
165
|
+
{ p: 0.00, v: 0 },
|
|
166
|
+
{ p: 0.46, v: 0.08 },
|
|
167
|
+
{ p: 0.70, v: 0.20 },
|
|
168
|
+
{ p: 0.86, v: 0.07 },
|
|
169
|
+
{ p: 1.00, v: 0 },
|
|
170
|
+
]);
|
|
171
|
+
const impact = Math.sin(Math.PI * smoothstep(0.38, 0.68, p));
|
|
172
|
+
const settle = Math.sin(Math.PI * smoothstep(0.64, 0.90, p)) * 0.35;
|
|
173
|
+
const squash = params.squash * (impact - settle);
|
|
174
|
+
const sx = 1 - squash;
|
|
175
|
+
const sy = 1 + squash * 0.85;
|
|
176
|
+
const eyeDrop = params.eyeDrop + impact * 0.08 - settle * 0.03;
|
|
177
|
+
const eyeSoft = 0.10 + impact * 0.08;
|
|
178
|
+
const eyeStroke = 0.72 + impact * 0.035;
|
|
179
|
+
const flowOffset = Math.sin(2 * Math.PI * easeOutCubic(bodyP)) * 2.2;
|
|
180
|
+
return { p, tx, ty, rot, sx, sy, eyeDrop, eyeSoft, eyeStroke, flowOffset };
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function sleepyEyePath(base, drop, soft) {
|
|
184
|
+
const x1 = base.cx - base.w / 2;
|
|
185
|
+
const x2 = base.cx + base.w / 2;
|
|
186
|
+
const cy = base.cy + drop;
|
|
187
|
+
const mid = cy + base.h * 0.48 + soft;
|
|
188
|
+
const c1x = base.cx - base.w * 0.17;
|
|
189
|
+
const c2x = base.cx + base.w * 0.17;
|
|
190
|
+
const tilt = base.tilt * 0.018;
|
|
191
|
+
return `M ${x1.toFixed(2)} ${(cy - tilt).toFixed(2)} C ${c1x.toFixed(2)} ${mid.toFixed(2)} ${c2x.toFixed(2)} ${mid.toFixed(2)} ${x2.toFixed(2)} ${(cy + tilt).toFixed(2)}`;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function setSleepyEye(path, base, state) {
|
|
195
|
+
path.setAttribute("d", sleepyEyePath(base, state.eyeDrop, state.eyeSoft));
|
|
196
|
+
path.setAttribute("stroke-width", state.eyeStroke.toFixed(3));
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function renderProgress(p) {
|
|
200
|
+
const s = stateAt(clamp(p, 0, 1));
|
|
201
|
+
enter.setAttribute(
|
|
202
|
+
"transform",
|
|
203
|
+
`translate(${s.tx.toFixed(3)} ${s.ty.toFixed(3)}) translate(12 12) rotate(${s.rot.toFixed(3)}) scale(${s.sx.toFixed(4)} ${s.sy.toFixed(4)}) translate(-12 -12)`
|
|
204
|
+
);
|
|
205
|
+
setSleepyEye(eyeL, EYE_BASE.l, s);
|
|
206
|
+
setSleepyEye(eyeR, EYE_BASE.r, s);
|
|
207
|
+
eyeGrad.setAttribute("y1", (3 + s.flowOffset).toFixed(2));
|
|
208
|
+
eyeGrad.setAttribute("y2", (21 + s.flowOffset).toFixed(2));
|
|
209
|
+
progressReadout.textContent = `progress: ${s.p.toFixed(2)}`;
|
|
210
|
+
poseReadout.textContent = `tx: ${s.tx.toFixed(2)}, rot: ${s.rot.toFixed(1)}deg, scale: ${s.sx.toFixed(2)} ${s.sy.toFixed(2)}`;
|
|
211
|
+
lastState = s;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function tick(now) {
|
|
215
|
+
if (playing) {
|
|
216
|
+
const p = (now - startT) / (params.duration * 1000);
|
|
217
|
+
heldProgress = clamp(p, 0, 1);
|
|
218
|
+
renderProgress(heldProgress);
|
|
219
|
+
if (p >= 1) playing = false;
|
|
220
|
+
}
|
|
221
|
+
requestAnimationFrame(tick);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function replay() {
|
|
225
|
+
startT = performance.now();
|
|
226
|
+
heldProgress = 0;
|
|
227
|
+
playing = true;
|
|
228
|
+
renderProgress(0);
|
|
229
|
+
}
|
|
230
|
+
requestAnimationFrame(tick);
|
|
231
|
+
]]></script>
|
|
232
|
+
</svg>
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
<svg id="cloudling" xmlns="http://www.w3.org/2000/svg" width="480" height="480" viewBox="-12 -12 48 48" preserveAspectRatio="xMidYMid meet">
|
|
2
|
+
<style><![CDATA[
|
|
3
|
+
.v {
|
|
4
|
+
text-align: right;
|
|
5
|
+
font: 600 10px ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
6
|
+
color: #7A9DFF;
|
|
7
|
+
}
|
|
8
|
+
.edge-rim-tight { stroke-opacity: .65; }
|
|
9
|
+
.edge-rim-soft { stroke-opacity: .50; }
|
|
10
|
+
.edge-contact { stroke-opacity: .65; }
|
|
11
|
+
.duration-probe {
|
|
12
|
+
opacity: 0;
|
|
13
|
+
animation: mini-happy-duration-probe 3.6s linear 1 both;
|
|
14
|
+
}
|
|
15
|
+
@keyframes mini-happy-duration-probe {
|
|
16
|
+
from { transform: translateX(0); }
|
|
17
|
+
to { transform: translateX(0); }
|
|
18
|
+
}
|
|
19
|
+
@media (prefers-color-scheme: light) {
|
|
20
|
+
.v { color: #3941FF; }
|
|
21
|
+
.edge-rim-tight { stroke-opacity: .75; }
|
|
22
|
+
.edge-rim-soft { stroke-opacity: .60; }
|
|
23
|
+
.edge-contact { stroke-opacity: .75; }
|
|
24
|
+
.cloud-drop-shadow { flood-opacity: .13; }
|
|
25
|
+
.food-cloud-shadow { flood-opacity: .28; flood-color: #5060FF; }
|
|
26
|
+
.food-cloud > path {
|
|
27
|
+
stroke: #5870E8 !important;
|
|
28
|
+
stroke-width: 1.2 !important;
|
|
29
|
+
stroke-opacity: .9 !important;
|
|
30
|
+
vector-effect: non-scaling-stroke !important;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
]]></style>
|
|
34
|
+
<defs>
|
|
35
|
+
<linearGradient id="body-grad" x1="12" y1="2" x2="12" y2="22" gradientUnits="userSpaceOnUse">
|
|
36
|
+
<stop offset="0" stop-color="#f0f9ff"/>
|
|
37
|
+
<stop offset=".5" stop-color="#e0f2fe"/>
|
|
38
|
+
<stop offset="1" stop-color="#bae6fd"/>
|
|
39
|
+
</linearGradient>
|
|
40
|
+
<linearGradient id="eye-grad" x1="12" y1="3" x2="12" y2="21" gradientUnits="userSpaceOnUse">
|
|
41
|
+
<stop offset="0" stop-color="#B1A7FF"/>
|
|
42
|
+
<stop offset=".5" stop-color="#7A9DFF"/>
|
|
43
|
+
<stop offset="1" stop-color="#3941FF"/>
|
|
44
|
+
</linearGradient>
|
|
45
|
+
<linearGradient id="visible-bias-grad" x1="0" y1="12" x2="24" y2="12" gradientUnits="userSpaceOnUse">
|
|
46
|
+
<stop offset="0" stop-color="#f0f9ff" stop-opacity=".95"/>
|
|
47
|
+
<stop offset=".48" stop-color="#eaf7ff" stop-opacity=".58"/>
|
|
48
|
+
<stop offset="1" stop-color="#f0f9ff" stop-opacity=".26"/>
|
|
49
|
+
</linearGradient>
|
|
50
|
+
<radialGradient id="hi-grad" cx=".45" cy=".25" r=".55">
|
|
51
|
+
<stop offset="0" stop-color="#f0f9ff" stop-opacity=".9"/>
|
|
52
|
+
<stop offset="1" stop-color="#f0f9ff" stop-opacity="0"/>
|
|
53
|
+
</radialGradient>
|
|
54
|
+
<filter id="drop" x="-40%" y="-40%" width="180%" height="180%">
|
|
55
|
+
<feDropShadow class="cloud-drop-shadow" dx="0" dy=".55" stdDeviation=".72" flood-color="#3941FF" flood-opacity=".17"/>
|
|
56
|
+
</filter>
|
|
57
|
+
<filter id="edge-blur" x="-40%" y="-40%" width="180%" height="180%">
|
|
58
|
+
<feGaussianBlur stdDeviation=".16"/>
|
|
59
|
+
</filter>
|
|
60
|
+
<filter id="ring-glow" x="-70%" y="-70%" width="240%" height="240%">
|
|
61
|
+
<feGaussianBlur stdDeviation=".48" result="blur"/>
|
|
62
|
+
<feColorMatrix in="blur" type="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 .45 0" result="soft"/>
|
|
63
|
+
<feMerge>
|
|
64
|
+
<feMergeNode in="soft"/>
|
|
65
|
+
<feMergeNode in="SourceGraphic"/>
|
|
66
|
+
</feMerge>
|
|
67
|
+
</filter>
|
|
68
|
+
<path id="cloud-shape" d="M9.064 3.344a4.578 4.578 0 012.285-.312c1 .115 1.891.54 2.673 1.275.01.01.024.017.037.021a.09.09 0 00.043 0 4.55 4.55 0 013.046.275l.047.022.116.057a4.581 4.581 0 012.188 2.399c.209.51.313 1.041.315 1.595a4.24 4.24 0 01-.134 1.223.123.123 0 00.03.115c.594.607.988 1.33 1.183 2.17.289 1.425-.007 2.71-.887 3.854l-.136.166a4.548 4.548 0 01-2.201 1.388.123.123 0 00-.081.076c-.191.551-.383 1.023-.74 1.494-.9 1.187-2.222 1.846-3.711 1.838-1.187-.006-2.239-.44-3.157-1.302a.107.107 0 00-.105-.024c-.388.125-.78.143-1.204.138a4.441 4.441 0 01-1.945-.466 4.544 4.544 0 01-1.61-1.335c-.152-.202-.303-.392-.414-.617a5.81 5.81 0 01-.37-.961 4.582 4.582 0 01-.014-2.298.124.124 0 00.006-.056.085.085 0 00-.027-.048 4.467 4.467 0 01-1.034-1.651 3.896 3.896 0 01-.251-1.192 5.189 5.189 0 01.141-1.6c.337-1.112.982-1.985 1.933-2.618.212-.141.413-.251.601-.33.215-.089.43-.164.646-.227a.098.098 0 00.065-.066 4.51 4.51 0 01.829-1.615 4.535 4.535 0 011.837-1.388z"/>
|
|
69
|
+
<clipPath id="cloud-clip">
|
|
70
|
+
<use href="#cloud-shape"/>
|
|
71
|
+
</clipPath>
|
|
72
|
+
</defs>
|
|
73
|
+
|
|
74
|
+
<rect x="-12" y="-12" width="48" height="48" fill="transparent"/>
|
|
75
|
+
<rect class="duration-probe" x="-12" y="-12" width="0.01" height="0.01" fill="transparent"/>
|
|
76
|
+
|
|
77
|
+
<g id="runtime-layer">
|
|
78
|
+
<g id="rainbowRing" filter="url(#ring-glow)">
|
|
79
|
+
<use id="halo" href="#cloud-shape" fill="none" stroke="#fff" stroke-width="6.4" stroke-linecap="round" stroke-linejoin="round" pathLength="100" stroke-dasharray="0 100" stroke-dashoffset="-16" stroke-opacity="0"/>
|
|
80
|
+
<use id="r4" href="#cloud-shape" fill="none" stroke="#FF8FC6" stroke-width="5.1" stroke-linecap="round" stroke-linejoin="round" pathLength="100" stroke-dasharray="0 100" stroke-dashoffset="-16" stroke-opacity="0"/>
|
|
81
|
+
<use id="r3" href="#cloud-shape" fill="none" stroke="#58E6D4" stroke-width="3.9" stroke-linecap="round" stroke-linejoin="round" pathLength="100" stroke-dasharray="0 100" stroke-dashoffset="-16" stroke-opacity="0"/>
|
|
82
|
+
<use id="r2" href="#cloud-shape" fill="none" stroke="#61B8FF" stroke-width="2.65" stroke-linecap="round" stroke-linejoin="round" pathLength="100" stroke-dasharray="0 100" stroke-dashoffset="-16" stroke-opacity="0"/>
|
|
83
|
+
<use id="r1" href="#cloud-shape" fill="none" stroke="#9A8CFF" stroke-width="1.55" stroke-linecap="round" stroke-linejoin="round" pathLength="100" stroke-dasharray="0 100" stroke-dashoffset="-16" stroke-opacity="0"/>
|
|
84
|
+
<use id="visibleBias" href="#cloud-shape" fill="none" stroke="url(#visible-bias-grad)" stroke-width="5.8" stroke-linecap="round" stroke-linejoin="round" pathLength="100" stroke-dasharray="100 .01" stroke-opacity="0"/>
|
|
85
|
+
<use id="runnerAura" href="#cloud-shape" fill="none" stroke="#fff" stroke-width="3.5" stroke-linecap="round" stroke-linejoin="round" pathLength="100" stroke-dasharray="3.6 96.4" stroke-dashoffset="-16" stroke-opacity="0"/>
|
|
86
|
+
<use id="runnerTail" href="#cloud-shape" fill="none" stroke="#DFF7FF" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" pathLength="100" stroke-dasharray="7.2 92.8" stroke-dashoffset="-16" stroke-opacity="0"/>
|
|
87
|
+
<use id="runnerCore" href="#cloud-shape" fill="none" stroke="#fff" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" pathLength="100" stroke-dasharray="2.35 97.65" stroke-dashoffset="-16" stroke-opacity="0"/>
|
|
88
|
+
</g>
|
|
89
|
+
|
|
90
|
+
<g id="sparkles">
|
|
91
|
+
<circle class="spark" cx="0" cy="0" r=".30" fill="#F3FBFF"/>
|
|
92
|
+
<path class="spark" d="M0 -0.48 L0.48 0 L0 0.48 L-0.48 0 Z" fill="#58E6D4"/>
|
|
93
|
+
<circle class="spark" cx="0" cy="0" r=".24" fill="#FF8FC6"/>
|
|
94
|
+
<path class="spark" d="M0 -0.40 L0.40 0 L0 0.40 L-0.40 0 Z" fill="#9A8CFF"/>
|
|
95
|
+
<circle class="spark" cx="0" cy="0" r=".22" fill="#FFFFFF"/>
|
|
96
|
+
<circle class="spark" cx="0" cy="0" r=".20" fill="#61B8FF"/>
|
|
97
|
+
</g>
|
|
98
|
+
|
|
99
|
+
<g id="cloudWrap">
|
|
100
|
+
<g id="body-js">
|
|
101
|
+
<g id="edge-system">
|
|
102
|
+
<use class="edge-contact" href="#cloud-shape" fill="none" stroke="#7d8aa7" stroke-width="1.00" stroke-linejoin="round" transform="translate(0 .18)" filter="url(#edge-blur)"/>
|
|
103
|
+
<use class="edge-rim-soft" href="#cloud-shape" fill="none" stroke="#7A9DFF" stroke-width=".84" stroke-linejoin="round" filter="url(#edge-blur)"/>
|
|
104
|
+
<use class="edge-rim-tight" href="#cloud-shape" fill="none" stroke="#aab3c6" stroke-width=".38" stroke-linejoin="round"/>
|
|
105
|
+
</g>
|
|
106
|
+
<g filter="url(#drop)">
|
|
107
|
+
<use href="#cloud-shape" fill="url(#body-grad)"/>
|
|
108
|
+
<rect x="1" y="2" width="22" height="11" fill="url(#hi-grad)" clip-path="url(#cloud-clip)"/>
|
|
109
|
+
</g>
|
|
110
|
+
</g>
|
|
111
|
+
<g id="eyes-js">
|
|
112
|
+
<g id="capsuleEye">
|
|
113
|
+
<rect id="capL" x="6.65" y="9.65" width="2.2" height="4.65" rx="1.1" fill="url(#eye-grad)" stroke="#ffffff" stroke-width="0.08" stroke-opacity="0.7"/>
|
|
114
|
+
<rect id="capR" x="11.05" y="9.65" width="2.2" height="4.65" rx="1.1" fill="url(#eye-grad)" stroke="#ffffff" stroke-width="0.08" stroke-opacity="0.7"/>
|
|
115
|
+
</g>
|
|
116
|
+
<g id="arcEye" opacity="0">
|
|
117
|
+
<path id="arcL" fill="none" stroke="url(#eye-grad)" stroke-width="1.05" stroke-linecap="round"/>
|
|
118
|
+
<path id="arcR" fill="none" stroke="url(#eye-grad)" stroke-width="1.05" stroke-linecap="round"/>
|
|
119
|
+
</g>
|
|
120
|
+
</g>
|
|
121
|
+
</g>
|
|
122
|
+
</g>
|
|
123
|
+
|
|
124
|
+
<g id="__cloudling-export-shims" opacity="0" pointer-events="none" style="display:none">
|
|
125
|
+
<g id="phase-readout"></g>
|
|
126
|
+
<g id="time-readout"></g>
|
|
127
|
+
</g>
|
|
128
|
+
|
|
129
|
+
<script type="application/ecmascript"><![CDATA[
|
|
130
|
+
const ring = document.getElementById("rainbowRing");
|
|
131
|
+
const visibleBias = document.getElementById("visibleBias");
|
|
132
|
+
const halo = document.getElementById("halo");
|
|
133
|
+
const runnerAura = document.getElementById("runnerAura");
|
|
134
|
+
const runnerTail = document.getElementById("runnerTail");
|
|
135
|
+
const runnerCore = document.getElementById("runnerCore");
|
|
136
|
+
const ringLayers = [
|
|
137
|
+
{ el: document.getElementById("r1"), opacity: .74 },
|
|
138
|
+
{ el: document.getElementById("r2"), opacity: .68 },
|
|
139
|
+
{ el: document.getElementById("r3"), opacity: .58 },
|
|
140
|
+
{ el: document.getElementById("r4"), opacity: .48 },
|
|
141
|
+
];
|
|
142
|
+
const cloudWrap = document.getElementById("cloudWrap");
|
|
143
|
+
const capsule = document.getElementById("capsuleEye");
|
|
144
|
+
const arcEye = document.getElementById("arcEye");
|
|
145
|
+
const arcL = document.getElementById("arcL");
|
|
146
|
+
const arcR = document.getElementById("arcR");
|
|
147
|
+
const sparkEls = [...document.querySelectorAll(".spark")];
|
|
148
|
+
const phaseReadout = document.getElementById("phase-readout");
|
|
149
|
+
const timeReadout = document.getElementById("time-readout");
|
|
150
|
+
|
|
151
|
+
const SWEEP_OFFSET = -16;
|
|
152
|
+
const RING_COUNT = 4;
|
|
153
|
+
const SMILE = { h: .72, w: 2.65 };
|
|
154
|
+
const LAUGH = { h: 1.02, w: 3.05 };
|
|
155
|
+
const EYE_CY = 12.62;
|
|
156
|
+
const CX_L = 7.75;
|
|
157
|
+
const CX_R = 12.15;
|
|
158
|
+
const sparks = [
|
|
159
|
+
{ x: 3.2, y: 6.3, dx: -2.15, dy: -1.45, d: 0.00, s: 1.10, rot: -18, alpha: 1.00 },
|
|
160
|
+
{ x: 1.9, y: 14.6, dx: -2.10, dy: .95, d: .14, s: .98, rot: -28, alpha: .96 },
|
|
161
|
+
{ x: 8.6, y: 21.2, dx: -.8, dy: 1.95, d: .24, s: .86, rot: 12, alpha: .88 },
|
|
162
|
+
{ x: 20.4, y: 6.2, dx: 2.05, dy: -1.35, d: .08, s: .88, rot: 24, alpha: .80 },
|
|
163
|
+
{ x: 22.1, y: 15.0, dx: 2.05, dy: 1.25, d: .20, s: .82, rot: -14, alpha: .76 },
|
|
164
|
+
{ x: 13.8, y: 2.0, dx: .45, dy: -2.10, d: .30, s: .80, rot: 16, alpha: .72 },
|
|
165
|
+
];
|
|
166
|
+
const params = {
|
|
167
|
+
duration: 3.6,
|
|
168
|
+
ringPower: 1.25,
|
|
169
|
+
edgeBias: .30,
|
|
170
|
+
bounce: .040,
|
|
171
|
+
};
|
|
172
|
+
let startT = performance.now();
|
|
173
|
+
let paused = false;
|
|
174
|
+
let heldT = 0;
|
|
175
|
+
let lastRender = null;
|
|
176
|
+
|
|
177
|
+
function clamp(x, lo, hi) { return Math.max(lo, Math.min(hi, x)); }
|
|
178
|
+
function lerp(a, b, t) { return a + (b - a) * t; }
|
|
179
|
+
function easeOutCubic(x) { return 1 - Math.pow(1 - x, 3); }
|
|
180
|
+
function easeInCubic(x) { return x * x * x; }
|
|
181
|
+
function easeInOutCubic(x) {
|
|
182
|
+
return x < .5 ? 4 * x * x * x : 1 - Math.pow(-2 * x + 2, 3) / 2;
|
|
183
|
+
}
|
|
184
|
+
function arcPath(shape) {
|
|
185
|
+
const w2 = shape.w / 2;
|
|
186
|
+
const peakY = EYE_CY - 2 * shape.h;
|
|
187
|
+
return {
|
|
188
|
+
l: `M ${(CX_L - w2).toFixed(2)} ${EYE_CY} Q ${CX_L} ${peakY.toFixed(2)} ${(CX_L + w2).toFixed(2)} ${EYE_CY}`,
|
|
189
|
+
r: `M ${(CX_R - w2).toFixed(2)} ${EYE_CY} Q ${CX_R} ${peakY.toFixed(2)} ${(CX_R + w2).toFixed(2)} ${EYE_CY}`,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
function setArc(shape) {
|
|
193
|
+
const d = arcPath(shape);
|
|
194
|
+
arcL.setAttribute("d", d.l);
|
|
195
|
+
arcR.setAttribute("d", d.r);
|
|
196
|
+
}
|
|
197
|
+
function setCenteredTransform(el, sx, sy = sx, rot = 0, tx = 0, ty = 0) {
|
|
198
|
+
el.setAttribute("transform", `translate(${(12 + tx).toFixed(3)} ${(12 + ty).toFixed(3)}) rotate(${rot.toFixed(3)}) scale(${sx.toFixed(4)} ${sy.toFixed(4)}) translate(-12 -12)`);
|
|
199
|
+
}
|
|
200
|
+
function setRing(layerLevels, haloOpacity, scale, runnerProgress, runnerOpacity, edgeBoost) {
|
|
201
|
+
ringLayers.forEach(({ el, opacity }, i) => {
|
|
202
|
+
el.setAttribute("stroke-dasharray", "100 .01");
|
|
203
|
+
el.setAttribute("stroke-dashoffset", 0);
|
|
204
|
+
el.setAttribute("stroke-opacity", (clamp(layerLevels[i] || 0, 0, 1) * opacity * params.ringPower).toFixed(3));
|
|
205
|
+
});
|
|
206
|
+
halo.setAttribute("stroke-dasharray", "100 .01");
|
|
207
|
+
halo.setAttribute("stroke-dashoffset", 0);
|
|
208
|
+
halo.setAttribute("stroke-opacity", clamp(haloOpacity * params.ringPower, 0, .08).toFixed(3));
|
|
209
|
+
visibleBias.setAttribute("stroke-opacity", clamp(edgeBoost * params.edgeBias, 0, .35).toFixed(3));
|
|
210
|
+
const runnerOffset = SWEEP_OFFSET - 100 * runnerProgress;
|
|
211
|
+
runnerAura.setAttribute("stroke-dashoffset", runnerOffset.toFixed(2));
|
|
212
|
+
runnerTail.setAttribute("stroke-dashoffset", runnerOffset.toFixed(2));
|
|
213
|
+
runnerCore.setAttribute("stroke-dashoffset", runnerOffset.toFixed(2));
|
|
214
|
+
runnerAura.setAttribute("stroke-opacity", (runnerOpacity * .12 * params.ringPower).toFixed(3));
|
|
215
|
+
runnerTail.setAttribute("stroke-opacity", (runnerOpacity * .56 * params.ringPower).toFixed(3));
|
|
216
|
+
runnerCore.setAttribute("stroke-opacity", (runnerOpacity * .88 * params.ringPower).toFixed(3));
|
|
217
|
+
setCenteredTransform(ring, scale);
|
|
218
|
+
}
|
|
219
|
+
function setSparkles(amount) {
|
|
220
|
+
sparkEls.forEach((el, i) => {
|
|
221
|
+
const cfg = sparks[i];
|
|
222
|
+
const p = clamp((amount - cfg.d) / .92, 0, 1);
|
|
223
|
+
const visible = Math.sin(Math.PI * p);
|
|
224
|
+
const move = easeOutCubic(p);
|
|
225
|
+
const x = cfg.x + cfg.dx * move;
|
|
226
|
+
const y = cfg.y + cfg.dy * move;
|
|
227
|
+
const scale = cfg.s * (.52 + .86 * visible);
|
|
228
|
+
el.setAttribute("transform", `translate(${x.toFixed(2)} ${y.toFixed(2)}) rotate(${(cfg.rot + 70 * p).toFixed(1)}) scale(${scale.toFixed(3)})`);
|
|
229
|
+
el.setAttribute("opacity", (visible * cfg.alpha).toFixed(3));
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
function render(t) {
|
|
233
|
+
const total = params.duration;
|
|
234
|
+
const unit = total / 3.6;
|
|
235
|
+
const T_charge = .20 * unit;
|
|
236
|
+
const T_layers = 1.04 * unit;
|
|
237
|
+
const T_confirm = .18 * unit;
|
|
238
|
+
const T_hold = 1.38 * unit;
|
|
239
|
+
const T_fade = .54 * unit;
|
|
240
|
+
const T_back = .26 * unit;
|
|
241
|
+
const a1 = T_charge;
|
|
242
|
+
const a2 = a1 + T_layers;
|
|
243
|
+
const a3 = a2 + T_confirm;
|
|
244
|
+
const a4 = a3 + T_hold;
|
|
245
|
+
const a5 = a4 + T_fade;
|
|
246
|
+
const a6 = a5 + T_back;
|
|
247
|
+
|
|
248
|
+
let phase = "mini-idle baseline";
|
|
249
|
+
let layerLevels = [0, 0, 0, 0];
|
|
250
|
+
let haloOpacity = 0;
|
|
251
|
+
let ringScale = 1;
|
|
252
|
+
let runnerProgress = 0;
|
|
253
|
+
let runnerOpacity = 0;
|
|
254
|
+
let edgeBoost = 0;
|
|
255
|
+
let cloudSx = 1;
|
|
256
|
+
let cloudSy = 1;
|
|
257
|
+
let cloudRot = 0;
|
|
258
|
+
let capsuleOp = 1;
|
|
259
|
+
let arcOp = 0;
|
|
260
|
+
let eye = SMILE;
|
|
261
|
+
let sparkleAmount = 0;
|
|
262
|
+
|
|
263
|
+
if (t < a1) {
|
|
264
|
+
phase = "charge";
|
|
265
|
+
const p = t / T_charge;
|
|
266
|
+
const pulse = Math.sin(Math.PI * p);
|
|
267
|
+
cloudSx = 1 + .04 * pulse;
|
|
268
|
+
cloudSy = 1 - .055 * pulse;
|
|
269
|
+
} else if (t < a2) {
|
|
270
|
+
const p = (t - a1) / T_layers;
|
|
271
|
+
const laps = p * RING_COUNT;
|
|
272
|
+
const completed = Math.min(RING_COUNT, Math.floor(laps));
|
|
273
|
+
const lapLocal = laps - completed;
|
|
274
|
+
const lightIn = easeOutCubic(clamp(p * 4, 0, 1));
|
|
275
|
+
const justLit = completed > 0 ? Math.max(0, 1 - (lapLocal * T_layers / RING_COUNT) / .09) : 0;
|
|
276
|
+
phase = `runner ${Math.min(completed + 1, RING_COUNT)}/${RING_COUNT}`;
|
|
277
|
+
layerLevels = ringLayers.map((_, i) => i < completed ? 1 : 0);
|
|
278
|
+
ringScale = 1 + .010 * lightIn + .008 * justLit;
|
|
279
|
+
runnerProgress = laps;
|
|
280
|
+
runnerOpacity = .88 * lightIn;
|
|
281
|
+
edgeBoost = .20 * lightIn + .30 * justLit;
|
|
282
|
+
cloudSx = cloudSy = 1 + .010 * lightIn + params.bounce * .35 * justLit;
|
|
283
|
+
capsuleOp = 1 - easeOutCubic(clamp(p * 1.55, 0, 1));
|
|
284
|
+
arcOp = easeOutCubic(clamp(p * 1.55, 0, 1));
|
|
285
|
+
eye = {
|
|
286
|
+
h: lerp(SMILE.h, LAUGH.h, easeInOutCubic(clamp((p - .16) / .84, 0, 1))),
|
|
287
|
+
w: lerp(SMILE.w, LAUGH.w, easeInOutCubic(clamp((p - .16) / .84, 0, 1))),
|
|
288
|
+
};
|
|
289
|
+
} else if (t < a3) {
|
|
290
|
+
phase = "confirm pop";
|
|
291
|
+
const p = (t - a2) / T_confirm;
|
|
292
|
+
const pop = Math.sin(Math.PI * p);
|
|
293
|
+
layerLevels = [1, 1, 1, 1];
|
|
294
|
+
haloOpacity = .035;
|
|
295
|
+
ringScale = 1.012 + .014 * pop;
|
|
296
|
+
runnerProgress = RING_COUNT + p;
|
|
297
|
+
runnerOpacity = .82 * (1 - .25 * p);
|
|
298
|
+
edgeBoost = .42 + .20 * pop;
|
|
299
|
+
cloudSx = cloudSy = 1.014 + params.bounce * pop;
|
|
300
|
+
cloudRot = 1.8 * Math.sin(2 * Math.PI * p);
|
|
301
|
+
capsuleOp = 0;
|
|
302
|
+
arcOp = 1;
|
|
303
|
+
eye = LAUGH;
|
|
304
|
+
sparkleAmount = p * .72;
|
|
305
|
+
} else if (t < a4) {
|
|
306
|
+
phase = "happy hold";
|
|
307
|
+
const p = (t - a3) / T_hold;
|
|
308
|
+
layerLevels = [1, 1, 1, 1];
|
|
309
|
+
haloOpacity = .032;
|
|
310
|
+
ringScale = 1.020 + .004 * Math.sin(2 * Math.PI * p);
|
|
311
|
+
edgeBoost = .42 + .08 * Math.sin(2 * Math.PI * p);
|
|
312
|
+
cloudSx = cloudSy = 1.018 + .004 * Math.sin(2 * Math.PI * p);
|
|
313
|
+
capsuleOp = 0;
|
|
314
|
+
arcOp = 1;
|
|
315
|
+
eye = LAUGH;
|
|
316
|
+
sparkleAmount = .75 + p * .45;
|
|
317
|
+
} else if (t < a5) {
|
|
318
|
+
phase = "soft fade";
|
|
319
|
+
const p = (t - a4) / T_fade;
|
|
320
|
+
const keep = 1 - easeInCubic(p);
|
|
321
|
+
layerLevels = [1, 1, 1, 1].map(() => .10 + .90 * keep);
|
|
322
|
+
haloOpacity = .030 * keep;
|
|
323
|
+
ringScale = 1.004 + .018 * keep;
|
|
324
|
+
edgeBoost = .36 * keep;
|
|
325
|
+
cloudSx = cloudSy = 1 + .018 * keep;
|
|
326
|
+
capsuleOp = 0;
|
|
327
|
+
arcOp = 1;
|
|
328
|
+
eye = {
|
|
329
|
+
h: lerp(LAUGH.h, SMILE.h, easeInOutCubic(p)),
|
|
330
|
+
w: lerp(LAUGH.w, SMILE.w, easeInOutCubic(p)),
|
|
331
|
+
};
|
|
332
|
+
sparkleAmount = 1.2;
|
|
333
|
+
} else if (t < a6) {
|
|
334
|
+
phase = "return";
|
|
335
|
+
const p = (t - a5) / T_back;
|
|
336
|
+
const out = 1 - easeOutCubic(p);
|
|
337
|
+
layerLevels = [1, 1, 1, 1].map(() => .10 * out);
|
|
338
|
+
haloOpacity = .015 * out;
|
|
339
|
+
ringScale = 1 + .015 * out;
|
|
340
|
+
edgeBoost = .16 * out;
|
|
341
|
+
capsuleOp = easeInOutCubic(p);
|
|
342
|
+
arcOp = 1 - easeInOutCubic(p);
|
|
343
|
+
eye = SMILE;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
setCenteredTransform(cloudWrap, cloudSx, cloudSy, cloudRot);
|
|
347
|
+
setRing(layerLevels, haloOpacity, ringScale, runnerProgress, runnerOpacity, edgeBoost);
|
|
348
|
+
setSparkles(sparkleAmount);
|
|
349
|
+
capsule.setAttribute("opacity", capsuleOp.toFixed(3));
|
|
350
|
+
arcEye.setAttribute("opacity", arcOp.toFixed(3));
|
|
351
|
+
setArc(eye);
|
|
352
|
+
phaseReadout.textContent = `phase: ${phase}`;
|
|
353
|
+
timeReadout.textContent = `time: ${clamp(t, 0, params.duration).toFixed(2)} / ${params.duration.toFixed(2)}`;
|
|
354
|
+
lastRender = { t, phase, layerLevels, runnerOpacity, edgeBoost, capsuleOp, arcOp };
|
|
355
|
+
}
|
|
356
|
+
function tick(now) {
|
|
357
|
+
if (!paused) {
|
|
358
|
+
heldT = ((now - startT) / 1000) % (params.duration + .42);
|
|
359
|
+
render(heldT > params.duration ? 0 : heldT);
|
|
360
|
+
}
|
|
361
|
+
requestAnimationFrame(tick);
|
|
362
|
+
}
|
|
363
|
+
function replay() {
|
|
364
|
+
startT = performance.now();
|
|
365
|
+
heldT = 0;
|
|
366
|
+
paused = false;
|
|
367
|
+
render(0);
|
|
368
|
+
}
|
|
369
|
+
requestAnimationFrame(tick);
|
|
370
|
+
]]></script>
|
|
371
|
+
</svg>
|