@plotdb/lotion 0.1.0 → 0.3.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/CHANGELOG.md +37 -0
- package/README.md +93 -27
- package/cli.js +157 -77
- package/index.css +12 -1
- package/index.js +185 -4
- package/index.min.css +1 -1
- package/index.min.js +1 -1
- package/package.json +1 -1
- package/prompt/{explainer.md → lotion.md} +7 -29
- package/vector.js +817 -0
- package/vector.min.js +1 -0
- package/audio/beats.py +0 -93
- package/audio/bgm.py +0 -181
- package/audio/common.py +0 -30
- package/audio/mix.py +0 -51
- package/audio/sfx.py +0 -93
- package/prompt/ui-loop.md +0 -497
package/prompt/ui-loop.md
DELETED
|
@@ -1,497 +0,0 @@
|
|
|
1
|
-
You are a senior motion designer and creative frontend engineer.
|
|
2
|
-
|
|
3
|
-
Your task is to create a premium, Dribbble-level UI motion design entirely with code.
|
|
4
|
-
|
|
5
|
-
Do NOT start coding immediately.
|
|
6
|
-
|
|
7
|
-
PHASE 1 — ASK FOR INPUTS
|
|
8
|
-
|
|
9
|
-
First ask me for:
|
|
10
|
-
|
|
11
|
-
1. 8–12 UI states that the main shape should transform into.
|
|
12
|
-
Examples:
|
|
13
|
-
|
|
14
|
-
- Button
|
|
15
|
-
- Loader
|
|
16
|
-
- Success check
|
|
17
|
-
- Dynamic Island
|
|
18
|
-
- Music player
|
|
19
|
-
- Progress scrubber
|
|
20
|
-
- Volume slider
|
|
21
|
-
- Toggle
|
|
22
|
-
- Tabs
|
|
23
|
-
- Chart
|
|
24
|
-
- Command palette
|
|
25
|
-
- Toast
|
|
26
|
-
|
|
27
|
-
2. Visual palette:
|
|
28
|
-
|
|
29
|
-
- Pure black + white
|
|
30
|
-
- OR black + white + one accent color
|
|
31
|
-
|
|
32
|
-
3. A royalty-free music track around 120 BPM.
|
|
33
|
-
|
|
34
|
-
Prefer music that can legally be used commercially, such as tracks from Mixkit or similar royalty-free libraries.
|
|
35
|
-
|
|
36
|
-
After I answer, DO NOT code yet.
|
|
37
|
-
|
|
38
|
-
---
|
|
39
|
-
|
|
40
|
-
PHASE 2 — BUILD THE MOTION SCORE
|
|
41
|
-
|
|
42
|
-
Create a beat-by-beat animation plan.
|
|
43
|
-
|
|
44
|
-
Target:
|
|
45
|
-
|
|
46
|
-
120 BPM
|
|
47
|
-
7 bars
|
|
48
|
-
4 beats per bar
|
|
49
|
-
28 primary beats
|
|
50
|
-
|
|
51
|
-
Something meaningful should happen on nearly every beat.
|
|
52
|
-
|
|
53
|
-
Show the timeline before writing code.
|
|
54
|
-
|
|
55
|
-
For every beat, define:
|
|
56
|
-
|
|
57
|
-
- beat number
|
|
58
|
-
- timestamp
|
|
59
|
-
- current UI state
|
|
60
|
-
- transformation
|
|
61
|
-
- cursor action
|
|
62
|
-
- camera action
|
|
63
|
-
- sound effect
|
|
64
|
-
- spring / easing behavior
|
|
65
|
-
|
|
66
|
-
Example flow:
|
|
67
|
-
|
|
68
|
-
Button
|
|
69
|
-
→ Loader
|
|
70
|
-
→ Check
|
|
71
|
-
→ Dynamic Island
|
|
72
|
-
→ Music Player
|
|
73
|
-
→ Play/Pause morph
|
|
74
|
-
→ Progress scrub
|
|
75
|
-
→ Volume slider
|
|
76
|
-
→ Overscroll/stretch
|
|
77
|
-
→ Toggle
|
|
78
|
-
→ Liquid tabs
|
|
79
|
-
→ Chart
|
|
80
|
-
→ Tooltip
|
|
81
|
-
→ Command palette
|
|
82
|
-
→ Search typing
|
|
83
|
-
→ Enter
|
|
84
|
-
→ Toast
|
|
85
|
-
→ Original button
|
|
86
|
-
|
|
87
|
-
The final state must transition perfectly into the first frame.
|
|
88
|
-
|
|
89
|
-
---
|
|
90
|
-
|
|
91
|
-
VISUAL DIRECTION
|
|
92
|
-
|
|
93
|
-
Aim for premium contemporary product motion design.
|
|
94
|
-
|
|
95
|
-
Reference quality:
|
|
96
|
-
|
|
97
|
-
- high-end Dribbble motion
|
|
98
|
-
- Linear
|
|
99
|
-
- Arc
|
|
100
|
-
- Raycast
|
|
101
|
-
- Apple system UI
|
|
102
|
-
- Stripe
|
|
103
|
-
- modern Vercel-style interfaces
|
|
104
|
-
|
|
105
|
-
Canvas:
|
|
106
|
-
|
|
107
|
-
1440 × 1440 square.
|
|
108
|
-
|
|
109
|
-
Background:
|
|
110
|
-
|
|
111
|
-
Light warm gray.
|
|
112
|
-
|
|
113
|
-
UI:
|
|
114
|
-
|
|
115
|
-
Mostly black and white.
|
|
116
|
-
|
|
117
|
-
Optionally one accent color.
|
|
118
|
-
|
|
119
|
-
Typography:
|
|
120
|
-
|
|
121
|
-
Geist or another clean modern UI sans-serif.
|
|
122
|
-
|
|
123
|
-
Icons:
|
|
124
|
-
|
|
125
|
-
Consistent stroke weight.
|
|
126
|
-
|
|
127
|
-
No mismatched icon families.
|
|
128
|
-
|
|
129
|
-
---
|
|
130
|
-
|
|
131
|
-
CORE MOTION RULE
|
|
132
|
-
|
|
133
|
-
There is ONE primary shape throughout the entire animation.
|
|
134
|
-
|
|
135
|
-
Never cut between unrelated objects.
|
|
136
|
-
|
|
137
|
-
Every interface state must feel like the SAME physical object transforming.
|
|
138
|
-
|
|
139
|
-
Transformation properties may include:
|
|
140
|
-
|
|
141
|
-
- width
|
|
142
|
-
- height
|
|
143
|
-
- border radius
|
|
144
|
-
- position
|
|
145
|
-
- fill
|
|
146
|
-
- stroke
|
|
147
|
-
- internal layout
|
|
148
|
-
- content
|
|
149
|
-
- clipping mask
|
|
150
|
-
|
|
151
|
-
Content may change during a morph using a very short blur/fade transition.
|
|
152
|
-
|
|
153
|
-
The object itself must remain visually continuous.
|
|
154
|
-
|
|
155
|
-
---
|
|
156
|
-
|
|
157
|
-
INTERACTION
|
|
158
|
-
|
|
159
|
-
A visible cursor drives the animation.
|
|
160
|
-
|
|
161
|
-
The cursor should:
|
|
162
|
-
|
|
163
|
-
- move intentionally
|
|
164
|
-
- click real controls
|
|
165
|
-
- drag sliders
|
|
166
|
-
- hover charts
|
|
167
|
-
- type into inputs
|
|
168
|
-
- trigger state changes
|
|
169
|
-
|
|
170
|
-
Avoid arbitrary cursor movement.
|
|
171
|
-
|
|
172
|
-
Every cursor action must have a visible cause and effect.
|
|
173
|
-
|
|
174
|
-
Clicks should feel tactile.
|
|
175
|
-
|
|
176
|
-
Drags must use direct manipulation.
|
|
177
|
-
|
|
178
|
-
While dragging:
|
|
179
|
-
|
|
180
|
-
value = function(cursor position)
|
|
181
|
-
|
|
182
|
-
Do not fake the slider movement independently of the pointer.
|
|
183
|
-
|
|
184
|
-
When released, the element may continue using a spring from its release position.
|
|
185
|
-
|
|
186
|
-
---
|
|
187
|
-
|
|
188
|
-
SPRINGS
|
|
189
|
-
|
|
190
|
-
Use springs extensively.
|
|
191
|
-
|
|
192
|
-
Do NOT use generic CSS easing curves for the primary motion.
|
|
193
|
-
|
|
194
|
-
Springs must be implemented as closed-form mathematical step responses.
|
|
195
|
-
|
|
196
|
-
Avoid exaggerated bouncing.
|
|
197
|
-
|
|
198
|
-
Desired character:
|
|
199
|
-
|
|
200
|
-
fast
|
|
201
|
-
precise
|
|
202
|
-
slightly physical
|
|
203
|
-
tiny overshoot at most
|
|
204
|
-
|
|
205
|
-
If a property changes target multiple times, compute it as the sum of independent spring responses for each target change.
|
|
206
|
-
|
|
207
|
-
The animation must remain a pure function of time.
|
|
208
|
-
|
|
209
|
-
---
|
|
210
|
-
|
|
211
|
-
LIQUID MOTION
|
|
212
|
-
|
|
213
|
-
For elements such as:
|
|
214
|
-
|
|
215
|
-
- tabs
|
|
216
|
-
- toggles
|
|
217
|
-
- sliders
|
|
218
|
-
- pills
|
|
219
|
-
|
|
220
|
-
animate the leading and trailing edges independently.
|
|
221
|
-
|
|
222
|
-
Example:
|
|
223
|
-
|
|
224
|
-
When a tab indicator moves right:
|
|
225
|
-
|
|
226
|
-
leading edge spring → faster
|
|
227
|
-
|
|
228
|
-
trailing edge spring → slightly slower
|
|
229
|
-
|
|
230
|
-
This creates temporary stretching.
|
|
231
|
-
|
|
232
|
-
Then both edges converge.
|
|
233
|
-
|
|
234
|
-
Apply the same principle to the toggle knob.
|
|
235
|
-
|
|
236
|
-
The effect should feel elastic but restrained.
|
|
237
|
-
|
|
238
|
-
Never cartoonishly bouncy.
|
|
239
|
-
|
|
240
|
-
---
|
|
241
|
-
|
|
242
|
-
CAMERA
|
|
243
|
-
|
|
244
|
-
The virtual camera should subtly reframe each state.
|
|
245
|
-
|
|
246
|
-
Every important UI state should comfortably fill the composition.
|
|
247
|
-
|
|
248
|
-
Use:
|
|
249
|
-
|
|
250
|
-
- scale
|
|
251
|
-
- translation
|
|
252
|
-
|
|
253
|
-
Avoid unnecessary rotation.
|
|
254
|
-
|
|
255
|
-
Camera movement must also be driven entirely by time.
|
|
256
|
-
|
|
257
|
-
Avoid blurry text.
|
|
258
|
-
|
|
259
|
-
CRITICAL:
|
|
260
|
-
|
|
261
|
-
Do NOT apply "will-change" to elements that the camera scales.
|
|
262
|
-
|
|
263
|
-
It can cause browser text rasterization and make typography blurry.
|
|
264
|
-
|
|
265
|
-
---
|
|
266
|
-
|
|
267
|
-
TEXT TRANSITIONS
|
|
268
|
-
|
|
269
|
-
When content changes inside a morphing container:
|
|
270
|
-
|
|
271
|
-
old content must have a defined EXIT window.
|
|
272
|
-
|
|
273
|
-
new content must have a defined ENTER window.
|
|
274
|
-
|
|
275
|
-
Never allow both text states to occupy the same visual space unintentionally.
|
|
276
|
-
|
|
277
|
-
Suggested transition:
|
|
278
|
-
|
|
279
|
-
old text
|
|
280
|
-
→ fade + blur + slight movement
|
|
281
|
-
→ container morph
|
|
282
|
-
→ new text unblur + fade in
|
|
283
|
-
|
|
284
|
-
Keep transitions short.
|
|
285
|
-
|
|
286
|
-
---
|
|
287
|
-
|
|
288
|
-
AUDIO
|
|
289
|
-
|
|
290
|
-
Analyze the selected music using Python + NumPy.
|
|
291
|
-
|
|
292
|
-
Determine:
|
|
293
|
-
|
|
294
|
-
- BPM
|
|
295
|
-
- beat timestamps
|
|
296
|
-
- downbeats
|
|
297
|
-
- useful transients
|
|
298
|
-
|
|
299
|
-
Start the motion sequence on a strong downbeat.
|
|
300
|
-
|
|
301
|
-
Align important transitions to musical beats.
|
|
302
|
-
|
|
303
|
-
UI sound effects may include:
|
|
304
|
-
|
|
305
|
-
- click
|
|
306
|
-
- toggle
|
|
307
|
-
- pop
|
|
308
|
-
- scrub
|
|
309
|
-
- typing
|
|
310
|
-
- success
|
|
311
|
-
- notification
|
|
312
|
-
|
|
313
|
-
Measure each sound effect's actual transient peak.
|
|
314
|
-
|
|
315
|
-
Align the measured peak—not merely the start of the audio file—to the visual action.
|
|
316
|
-
|
|
317
|
-
---
|
|
318
|
-
|
|
319
|
-
IMPLEMENTATION ARCHITECTURE
|
|
320
|
-
|
|
321
|
-
Create ONE HTML file.
|
|
322
|
-
|
|
323
|
-
Resolution:
|
|
324
|
-
|
|
325
|
-
1440 × 1440
|
|
326
|
-
|
|
327
|
-
The entire animation must be controlled through:
|
|
328
|
-
|
|
329
|
-
seek(t)
|
|
330
|
-
|
|
331
|
-
where:
|
|
332
|
-
|
|
333
|
-
t = animation time in seconds
|
|
334
|
-
|
|
335
|
-
Every visual property must be derived from "t".
|
|
336
|
-
|
|
337
|
-
NO:
|
|
338
|
-
|
|
339
|
-
- CSS transitions
|
|
340
|
-
- setTimeout
|
|
341
|
-
- request-driven state machines
|
|
342
|
-
- persistent animation state
|
|
343
|
-
- frame-to-frame dependency
|
|
344
|
-
|
|
345
|
-
Given the same time value, "seek(t)" must always produce exactly the same frame.
|
|
346
|
-
|
|
347
|
-
This is essential for deterministic rendering.
|
|
348
|
-
|
|
349
|
-
---
|
|
350
|
-
|
|
351
|
-
RENDERING
|
|
352
|
-
|
|
353
|
-
Use Playwright to render frames.
|
|
354
|
-
|
|
355
|
-
Target final output:
|
|
356
|
-
|
|
357
|
-
60 FPS
|
|
358
|
-
|
|
359
|
-
For motion blur:
|
|
360
|
-
|
|
361
|
-
render 4 temporal subframes for every final frame.
|
|
362
|
-
|
|
363
|
-
Example:
|
|
364
|
-
|
|
365
|
-
frame t
|
|
366
|
-
|
|
367
|
-
samples:
|
|
368
|
-
|
|
369
|
-
t - 1.5Δ
|
|
370
|
-
t - 0.5Δ
|
|
371
|
-
t + 0.5Δ
|
|
372
|
-
t + 1.5Δ
|
|
373
|
-
|
|
374
|
-
Blend these using FFmpeg "tmix" or equivalent temporal averaging.
|
|
375
|
-
|
|
376
|
-
The motion blur must remain subtle.
|
|
377
|
-
|
|
378
|
-
UI must stay sharp enough to read.
|
|
379
|
-
|
|
380
|
-
---
|
|
381
|
-
|
|
382
|
-
PREVIEW VALIDATION
|
|
383
|
-
|
|
384
|
-
Before doing the full render:
|
|
385
|
-
|
|
386
|
-
render exactly ONE representative frame per beat.
|
|
387
|
-
|
|
388
|
-
Create a contact sheet or preview sequence.
|
|
389
|
-
|
|
390
|
-
Inspect:
|
|
391
|
-
|
|
392
|
-
- beat synchronization
|
|
393
|
-
- spacing
|
|
394
|
-
- typography
|
|
395
|
-
- clipping
|
|
396
|
-
- visual hierarchy
|
|
397
|
-
- cursor placement
|
|
398
|
-
- morph continuity
|
|
399
|
-
- camera framing
|
|
400
|
-
|
|
401
|
-
If anything is:
|
|
402
|
-
|
|
403
|
-
- off-grid
|
|
404
|
-
- cramped
|
|
405
|
-
- unreadable
|
|
406
|
-
- awkward
|
|
407
|
-
- visually discontinuous
|
|
408
|
-
|
|
409
|
-
fix it before the full render.
|
|
410
|
-
|
|
411
|
-
---
|
|
412
|
-
|
|
413
|
-
LOOP REQUIREMENT
|
|
414
|
-
|
|
415
|
-
The animation must loop perfectly.
|
|
416
|
-
|
|
417
|
-
The final frame must mathematically match the first frame.
|
|
418
|
-
|
|
419
|
-
Match:
|
|
420
|
-
|
|
421
|
-
- shape
|
|
422
|
-
- dimensions
|
|
423
|
-
- radius
|
|
424
|
-
- color
|
|
425
|
-
- internal content
|
|
426
|
-
- camera position
|
|
427
|
-
- camera scale
|
|
428
|
-
- cursor position
|
|
429
|
-
- cursor velocity
|
|
430
|
-
- animation velocity
|
|
431
|
-
|
|
432
|
-
Do not merely make the positions equal.
|
|
433
|
-
|
|
434
|
-
The velocity around the loop boundary must also feel continuous.
|
|
435
|
-
|
|
436
|
-
There should be no perceptible stutter when playback restarts.
|
|
437
|
-
|
|
438
|
-
---
|
|
439
|
-
|
|
440
|
-
BANNED
|
|
441
|
-
|
|
442
|
-
Do not use:
|
|
443
|
-
|
|
444
|
-
- exaggerated bouncy easing
|
|
445
|
-
- particle explosions
|
|
446
|
-
- random decorative particles
|
|
447
|
-
- glow-heavy interfaces
|
|
448
|
-
- gradients on UI chrome
|
|
449
|
-
- inconsistent icon strokes
|
|
450
|
-
- generic template animations
|
|
451
|
-
- excessive glassmorphism
|
|
452
|
-
- meaningless floating objects
|
|
453
|
-
- dead time
|
|
454
|
-
- unnecessary 3D transforms
|
|
455
|
-
- random camera movement
|
|
456
|
-
|
|
457
|
-
Every movement must communicate state, interaction, or rhythm.
|
|
458
|
-
|
|
459
|
-
---
|
|
460
|
-
|
|
461
|
-
DESIGN PRINCIPLE
|
|
462
|
-
|
|
463
|
-
The viewer should feel like they are watching ONE intelligent interface object continuously transform.
|
|
464
|
-
|
|
465
|
-
Not:
|
|
466
|
-
|
|
467
|
-
"a collection of UI animations."
|
|
468
|
-
|
|
469
|
-
But:
|
|
470
|
-
|
|
471
|
-
"one object performing a choreographed sequence."
|
|
472
|
-
|
|
473
|
-
Every transformation must answer:
|
|
474
|
-
|
|
475
|
-
Why did this object become the next thing?
|
|
476
|
-
|
|
477
|
-
The cursor, music, interaction, and physical motion should provide that answer.
|
|
478
|
-
|
|
479
|
-
---
|
|
480
|
-
|
|
481
|
-
EXECUTION ORDER
|
|
482
|
-
|
|
483
|
-
Follow this exact workflow:
|
|
484
|
-
|
|
485
|
-
1. Ask for my UI states, palette, and song.
|
|
486
|
-
2. Create the complete beat grid.
|
|
487
|
-
3. Show me the proposed state sequence.
|
|
488
|
-
4. Identify difficult morph transitions.
|
|
489
|
-
5. Design the spring / interaction strategy.
|
|
490
|
-
6. Only then write the HTML animation.
|
|
491
|
-
7. Render one frame per beat.
|
|
492
|
-
8. Visually inspect the preview.
|
|
493
|
-
9. Correct layout and timing problems.
|
|
494
|
-
10. Render the final 60 FPS video with motion blur.
|
|
495
|
-
11. Verify that the final frame loops seamlessly into the first.
|
|
496
|
-
|
|
497
|
-
Do not skip directly to implementation.
|