Skip to content
Back to skills

Generative

ASecurity

Motion that comes from rules or physics rather than keyframes - particles, fireworks, flocks, crowds, falling and colliding objects, pendulums, cellular automata, flow fields, shaders such as aurora or noise. Read before writing that code layer.

  • 5 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 4, 2026
ai-agentsgorailsspringaws

Security analysis

A100/100

Scanned December 4, 2026

npx -y skills add HumanHarness/MOGA --skill generative --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Generative?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Generative
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/humanharness-generative/badge)](https://www.skillsdirectory.com/skills/humanharness-generative)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: generative
kind: guide
description: Motion that comes from rules or physics rather than keyframes - particles, fireworks, flocks, crowds, falling and colliding objects, pendulums, cellular automata, flow fields, shaders such as aurora or noise. Read before writing that code layer.
---

A simulation's charm is that it is true to its rules. In a film it goes wrong two ways: it is not deterministic (each frame or render differs), or it quietly breaks its rules (energy grows, objects overlap, particles respawn and flicker). It is a code layer (`add_code`): canvas 2D up to tens of thousands of particles, three.js points or `InstancedMesh` (`import * as THREE from 'three'`, see three-d) or a fragment shader beyond that.

## 1. Bake, then sample (seek mode)

- Run the simulation once on load with a fixed step `dt` (and substeps) and store what you draw per step (positions, angles, live cells) in typed arrays.
- `window.seek = (t) => …` draws from the stored state at t: the two nearest steps, interpolated. It never advances the simulation, so any frame comes out the same in any order.
- `Math.random` is already seeded per layer (`seed` prop); still draw every random value once on load, per object, never inside `seek`.
- Slow motion is a uniform factor when sampling, never a change of `dt` mid-run.
- Before baking long, run a few hundred steps and check that the state changes and the rules hold.
- A short, cheap effect can instead use clock mode (an ordinary `requestAnimationFrame` loop): MOGA steps its clock one frame at a time, so frames repeat exactly, but a scrub backwards replays from the start. Prefer seek.

## 2. Integrators

| System                           | Use                                                                                                                                       |
| -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| projectile, plain gravity        | closed form (x = v₀t, y = v₀t − gt²/2), no integration                                                                                    |
| pendulums, orbits, chaos         | RK4 with a small dt and several substeps per frame; watch energy drift                                                                    |
| springs, cloth, sparks with drag | semi-implicit Euler or Verlet, fixed dt                                                                                                   |
| rigid bodies, stacks, dominoes   | a fixed-step solver (a small one of your own, or a physics library imported into the project), or a scripted motion when it must be exact |
| flocks, crowds                   | fixed-step steering (separation, alignment, cohesion, goal, avoidance) with a grid for neighbours                                         |
| cellular automata                | the exact discrete rule per generation, shown at a chosen rate                                                                            |

## 3. Rules you can check

Decide the invariants and test them after baking: counts constant, energy within ~1% where nothing loses it, rods keep their length, no interpenetration, things at rest truly stop. For chaos, trajectories start identical on screen and part only through the dynamics. Well-known patterns behave as known (Game of Life B3/S23: a glider moves one cell diagonally every 4 generations; a Gosper gun emits one every 30).

## 4. Particles

- Each particle has a stable index and seeded properties (birth, life, colour, size); its position is a function of t − birth, closed form or baked.
- Fields: curl noise for ink, smoke and drift; gravity plus drag for sparks; for particles that gather into a shape, give each one a fixed target point so the gathering can be followed.
- Fade by age; trails from the last few positions computed from t, never by leaving the previous frame on the canvas.

## 5. Shaders and fields

- A fragment shader driven only by a `uTime` uniform set from t (and the size) is deterministic by construction.
- fbm noise, domain warping and ray-marched layers make clouds, aurora, water and fire; dither gradients a little against banding.
- A loop: sample noise on a circle (cos 2πt/T, sin 2πt/T) in an extra dimension, so frame T equals frame 0.

## 6. Make the rule visible

Start on the interesting structure and widen to the emergent pattern. Colour carries state (age, speed, just born). Keep the background quiet; the simulation is busy enough. The hero effect is the brightest, most contrasting thing on screen: fireworks bigger and brighter than their reflections.

## 7. Check

`look` over the fastest events (from/to) for pops and respawn flicker; `look` the same t twice for identical frames; print the invariants once while baking (console errors come back with the layer).

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.