@dopaminefx/effect-checkmate 0.1.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/dist/checkmate-shader.d.ts +32 -0
- package/dist/checkmate-shader.d.ts.map +1 -0
- package/dist/checkmate-shader.js +253 -0
- package/dist/checkmate-shader.js.map +1 -0
- package/dist/checkmate.dope.json +354 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/package.json +46 -0
- package/src/checkmate-shader.ts +263 -0
- package/src/checkmate.dope.json +354 -0
- package/src/index.ts +39 -0
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
{
|
|
2
|
+
"fmt": "dopamine-effect",
|
|
3
|
+
"v": "1.0.0",
|
|
4
|
+
"id": "dopamine.success.checkmate",
|
|
5
|
+
"meta": {
|
|
6
|
+
"name": "Checkmate",
|
|
7
|
+
"description": "An unapologetically fabulous winning move: a chess QUEEN pops into place with an overshoot bounce, hurls an expanding RAINBOW swoosh-shockwave + a spinning pride sunburst, and is mobbed by twinkling 4-point sparkle bling. LGBTQ+ pride inspired (yas, queen). Heavy on whimsy + bling; high whimsy posterizes the rainbow into the canonical 6-stripe pride flag.",
|
|
8
|
+
"tags": [
|
|
9
|
+
"success",
|
|
10
|
+
"celebration",
|
|
11
|
+
"pride",
|
|
12
|
+
"chess",
|
|
13
|
+
"bling"
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"controls": {
|
|
17
|
+
"mood": {
|
|
18
|
+
"type": "enum",
|
|
19
|
+
"label": "Mood",
|
|
20
|
+
"default": "celebratory",
|
|
21
|
+
"options": [
|
|
22
|
+
"serene",
|
|
23
|
+
"celebratory",
|
|
24
|
+
"electric"
|
|
25
|
+
],
|
|
26
|
+
"ui": "segmented"
|
|
27
|
+
},
|
|
28
|
+
"intensity": {
|
|
29
|
+
"type": "scalar",
|
|
30
|
+
"label": "Intensity",
|
|
31
|
+
"default": 0.75,
|
|
32
|
+
"min": 0,
|
|
33
|
+
"max": 1,
|
|
34
|
+
"step": 0.01,
|
|
35
|
+
"ui": "slider",
|
|
36
|
+
"help": "Reward strength: pop overshoot, swoosh reach, sunburst energy, sparkle density + brightness."
|
|
37
|
+
},
|
|
38
|
+
"whimsy": {
|
|
39
|
+
"type": "scalar",
|
|
40
|
+
"label": "Whimsy",
|
|
41
|
+
"default": 0.6,
|
|
42
|
+
"min": 0,
|
|
43
|
+
"max": 1,
|
|
44
|
+
"step": 0.01,
|
|
45
|
+
"ui": "slider",
|
|
46
|
+
"help": "Photoreal smooth spectral glow (0) to a cel POP-ART pride flag (1): the rainbow posterizes into the canonical 6 stripes and the motion snaps on twos."
|
|
47
|
+
},
|
|
48
|
+
"seed": {
|
|
49
|
+
"type": "int",
|
|
50
|
+
"label": "Seed",
|
|
51
|
+
"default": null,
|
|
52
|
+
"nullable": true,
|
|
53
|
+
"help": "Null = unique sparkle scatter + accent palette per fire; pin to reproduce."
|
|
54
|
+
},
|
|
55
|
+
"origin": {
|
|
56
|
+
"type": "point",
|
|
57
|
+
"label": "Origin",
|
|
58
|
+
"default": "center"
|
|
59
|
+
},
|
|
60
|
+
"target": {
|
|
61
|
+
"type": "selector",
|
|
62
|
+
"label": "Target",
|
|
63
|
+
"default": "document.body"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"baselines": {
|
|
67
|
+
"serene": {
|
|
68
|
+
"durationMs": 2200,
|
|
69
|
+
"lightness": 0.88,
|
|
70
|
+
"chroma": 0.1,
|
|
71
|
+
"hueCenter": 300,
|
|
72
|
+
"hueRange": 320,
|
|
73
|
+
"bling": 0.7,
|
|
74
|
+
"swoosh": 0.82,
|
|
75
|
+
"rays": 8,
|
|
76
|
+
"spin": 0.4,
|
|
77
|
+
"sizeFrac": 0.26
|
|
78
|
+
},
|
|
79
|
+
"celebratory": {
|
|
80
|
+
"durationMs": 1700,
|
|
81
|
+
"lightness": 0.85,
|
|
82
|
+
"chroma": 0.18,
|
|
83
|
+
"hueCenter": 320,
|
|
84
|
+
"hueRange": 360,
|
|
85
|
+
"bling": 1,
|
|
86
|
+
"swoosh": 1,
|
|
87
|
+
"rays": 10,
|
|
88
|
+
"spin": 0.7,
|
|
89
|
+
"sizeFrac": 0.3
|
|
90
|
+
},
|
|
91
|
+
"electric": {
|
|
92
|
+
"durationMs": 1300,
|
|
93
|
+
"lightness": 0.82,
|
|
94
|
+
"chroma": 0.26,
|
|
95
|
+
"hueCenter": 330,
|
|
96
|
+
"hueRange": 300,
|
|
97
|
+
"bling": 1.35,
|
|
98
|
+
"swoosh": 1.2,
|
|
99
|
+
"rays": 12,
|
|
100
|
+
"spin": 1.05,
|
|
101
|
+
"sizeFrac": 0.34
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
"palette": {
|
|
105
|
+
"model": "oklch",
|
|
106
|
+
"space": "linear-srgb",
|
|
107
|
+
"generator": "golden-angle",
|
|
108
|
+
"goldenAngleDeg": 137.50776405003785,
|
|
109
|
+
"stops": 3,
|
|
110
|
+
"hueSpread": 0.7,
|
|
111
|
+
"lightness": {
|
|
112
|
+
"baseline": "lightness",
|
|
113
|
+
"perStop": [
|
|
114
|
+
0,
|
|
115
|
+
0.06,
|
|
116
|
+
-0.05
|
|
117
|
+
]
|
|
118
|
+
},
|
|
119
|
+
"chroma": {
|
|
120
|
+
"from": {
|
|
121
|
+
"mul": [
|
|
122
|
+
{
|
|
123
|
+
"baseline": "chroma"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"lerp": [
|
|
127
|
+
"intensity",
|
|
128
|
+
0.7,
|
|
129
|
+
1.5
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
},
|
|
134
|
+
"perStop": [
|
|
135
|
+
0,
|
|
136
|
+
0.02,
|
|
137
|
+
-0.01
|
|
138
|
+
]
|
|
139
|
+
},
|
|
140
|
+
"seed": {
|
|
141
|
+
"deterministic": true,
|
|
142
|
+
"source": "controls.seed",
|
|
143
|
+
"prng": "mulberry32",
|
|
144
|
+
"note": "Per-fire accent palette (used to TINT the sparkle bling) drawn from a wide hueRange so the glints sparkle in shifting colours. The hero rainbow is the procedural pride spectrum in the shader (independent of this register); this keeps the seed/parity machinery + per-fire novelty honest."
|
|
145
|
+
},
|
|
146
|
+
"perMood": {
|
|
147
|
+
"serene": {
|
|
148
|
+
"hueCenter": 300,
|
|
149
|
+
"hueRange": 320,
|
|
150
|
+
"lightness": 0.88,
|
|
151
|
+
"chroma": 0.1
|
|
152
|
+
},
|
|
153
|
+
"celebratory": {
|
|
154
|
+
"hueCenter": 320,
|
|
155
|
+
"hueRange": 360,
|
|
156
|
+
"lightness": 0.85,
|
|
157
|
+
"chroma": 0.18
|
|
158
|
+
},
|
|
159
|
+
"electric": {
|
|
160
|
+
"hueCenter": 330,
|
|
161
|
+
"hueRange": 300,
|
|
162
|
+
"lightness": 0.82,
|
|
163
|
+
"chroma": 0.26
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
"tempo": {
|
|
168
|
+
"durationMs": {
|
|
169
|
+
"from": {
|
|
170
|
+
"round": {
|
|
171
|
+
"mul": [
|
|
172
|
+
{
|
|
173
|
+
"baseline": "durationMs"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"lerp": [
|
|
177
|
+
"intensity",
|
|
178
|
+
1.1,
|
|
179
|
+
0.9
|
|
180
|
+
]
|
|
181
|
+
}
|
|
182
|
+
]
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
"frame": {
|
|
187
|
+
"amp": {
|
|
188
|
+
"envelope": [
|
|
189
|
+
{
|
|
190
|
+
"input": "life"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"param": "overshoot"
|
|
194
|
+
}
|
|
195
|
+
]
|
|
196
|
+
},
|
|
197
|
+
"extras": {
|
|
198
|
+
"pop": {
|
|
199
|
+
"easeOutBack": [
|
|
200
|
+
{
|
|
201
|
+
"clamp01": {
|
|
202
|
+
"div": [
|
|
203
|
+
{
|
|
204
|
+
"input": "life"
|
|
205
|
+
},
|
|
206
|
+
0.28
|
|
207
|
+
]
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"param": "overshoot"
|
|
212
|
+
}
|
|
213
|
+
]
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
"reducedMotion": {
|
|
218
|
+
"peakMs": 320,
|
|
219
|
+
"holdMs": 420
|
|
220
|
+
},
|
|
221
|
+
"note": "amp is the held-breath success envelope (brightness gate, decays to 0 — a transient reward). pop is a separate easeOutBack scale over the first 28% of life that OVERSHOOTS then settles to exactly 1 and HOLDS, so the queen bounces into place and stays full-size while the light fades around her."
|
|
222
|
+
},
|
|
223
|
+
"render": {
|
|
224
|
+
"params": {
|
|
225
|
+
"exposure": {
|
|
226
|
+
"type": "float",
|
|
227
|
+
"from": {
|
|
228
|
+
"lerp": [
|
|
229
|
+
"intensity",
|
|
230
|
+
0.9,
|
|
231
|
+
1.6
|
|
232
|
+
]
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
"bling": {
|
|
236
|
+
"type": "float",
|
|
237
|
+
"from": {
|
|
238
|
+
"mul": [
|
|
239
|
+
{
|
|
240
|
+
"baseline": "bling"
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
"lerp": [
|
|
244
|
+
"intensity",
|
|
245
|
+
0.7,
|
|
246
|
+
1.4
|
|
247
|
+
]
|
|
248
|
+
}
|
|
249
|
+
]
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
"swoosh": {
|
|
253
|
+
"type": "float",
|
|
254
|
+
"from": {
|
|
255
|
+
"mul": [
|
|
256
|
+
{
|
|
257
|
+
"baseline": "swoosh"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"lerp": [
|
|
261
|
+
"intensity",
|
|
262
|
+
0.8,
|
|
263
|
+
1.3
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
]
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
"rays": {
|
|
270
|
+
"type": "int",
|
|
271
|
+
"from": {
|
|
272
|
+
"round": {
|
|
273
|
+
"baseline": "rays"
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
"spin": {
|
|
278
|
+
"type": "float",
|
|
279
|
+
"from": {
|
|
280
|
+
"mul": [
|
|
281
|
+
{
|
|
282
|
+
"baseline": "spin"
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
"lerp": [
|
|
286
|
+
"intensity",
|
|
287
|
+
0.85,
|
|
288
|
+
1.25
|
|
289
|
+
]
|
|
290
|
+
}
|
|
291
|
+
]
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
"sizeFrac": {
|
|
295
|
+
"type": "float",
|
|
296
|
+
"from": {
|
|
297
|
+
"baseline": "sizeFrac"
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
"overshoot": {
|
|
301
|
+
"type": "float",
|
|
302
|
+
"from": {
|
|
303
|
+
"lerp": [
|
|
304
|
+
"intensity",
|
|
305
|
+
0.8,
|
|
306
|
+
1.6
|
|
307
|
+
]
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
"style": {
|
|
311
|
+
"type": "float",
|
|
312
|
+
"from": {
|
|
313
|
+
"control": "whimsy"
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
},
|
|
317
|
+
"shadowHeightFrac": 0.5,
|
|
318
|
+
"consts": {},
|
|
319
|
+
"config": {
|
|
320
|
+
"usesOrigin": true
|
|
321
|
+
},
|
|
322
|
+
"backends": {
|
|
323
|
+
"webgl2": {
|
|
324
|
+
"stage": "fullscreen-triangle",
|
|
325
|
+
"blend": "screen",
|
|
326
|
+
"shader": {
|
|
327
|
+
"program": "checkmate"
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
},
|
|
331
|
+
"fallbackOrder": [
|
|
332
|
+
"webgl2"
|
|
333
|
+
]
|
|
334
|
+
},
|
|
335
|
+
"binding": {
|
|
336
|
+
"note": "CROSS-PLATFORM uniform-binding contract. Which render.params are NOT shader uniforms, the seed-keyed scatter field (uSeed seeds the sparkle scatter), and the per-frame extras (the pop scale). No samplers — the chess queen is drawn analytically from 2D SDF primitives so it is byte-identical on web/Metal/GL with no baked-SDF aux texture.",
|
|
337
|
+
"excludeParams": [
|
|
338
|
+
"style",
|
|
339
|
+
"overshoot",
|
|
340
|
+
"durationMs"
|
|
341
|
+
],
|
|
342
|
+
"scatterKey": "checkmateSeed",
|
|
343
|
+
"scatterWeb": "uSeed",
|
|
344
|
+
"extras": [
|
|
345
|
+
{
|
|
346
|
+
"name": "pop",
|
|
347
|
+
"type": "float",
|
|
348
|
+
"web": "uPop",
|
|
349
|
+
"note": "easeOutBack pop scale 0→overshoot→1 (the queen's bounce-in, then held)"
|
|
350
|
+
}
|
|
351
|
+
],
|
|
352
|
+
"samplers": []
|
|
353
|
+
}
|
|
354
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checkmate — a fabulous winning move: a chess QUEEN pops into place and the
|
|
3
|
+
* frame erupts in LGBTQ+ pride (rainbow swoosh shockwave + spinning sunburst +
|
|
4
|
+
* twinkling sparkle bling). A success effect (serene / celebratory / electric).
|
|
5
|
+
*
|
|
6
|
+
* FULLY DATA-DRIVEN: params/palette/tempo come from checkmate.dope.json via the
|
|
7
|
+
* loader; the per-frame logic (the held-breath `amp` + the easeOutBack `pop`
|
|
8
|
+
* bounce) is `tempo.frame`; the uniform binding is the `.dope` `binding`
|
|
9
|
+
* contract. `registerDopeEffect` derives the whole pass config from the data —
|
|
10
|
+
* this module is just the rainbow SHADER + the registration call. The chess
|
|
11
|
+
* queen is analytic (2D SDFs), so the effect ships no swift/ or android/ folder.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { CHECKMATE_FRAGMENT_SRC, CHECKMATE_VERTEX_SRC } from "./checkmate-shader.js";
|
|
15
|
+
import { parseDope, registerDopeEffect, type EffectFactory, type PassParams } from "@dopaminefx/core";
|
|
16
|
+
import doc from "./checkmate.dope.json";
|
|
17
|
+
|
|
18
|
+
const DOPE = parseDope(doc as object);
|
|
19
|
+
|
|
20
|
+
/** The resolved render params Checkmate's shader consumes. */
|
|
21
|
+
export interface CheckmateParams extends PassParams {
|
|
22
|
+
exposure: number;
|
|
23
|
+
bling: number;
|
|
24
|
+
swoosh: number;
|
|
25
|
+
rays: number;
|
|
26
|
+
spin: number;
|
|
27
|
+
sizeFrac: number;
|
|
28
|
+
overshoot: number;
|
|
29
|
+
checkmateSeed: number;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// The whole factory (resolve / create / reducedMotion / program registration)
|
|
33
|
+
// is data: checkmate.dope.json interpreted by the core backbone.
|
|
34
|
+
export const checkmate = registerDopeEffect(DOPE, {
|
|
35
|
+
vertex: CHECKMATE_VERTEX_SRC,
|
|
36
|
+
fragment: CHECKMATE_FRAGMENT_SRC,
|
|
37
|
+
}) as EffectFactory<PassParams> as EffectFactory<CheckmateParams>;
|
|
38
|
+
|
|
39
|
+
export default checkmate;
|