Go to file
Orion Reed 5f30904b1d try a thing 2024-07-09 02:24:47 +01:00
.github/workflows prep for demo 2024-07-09 01:55:51 +01:00
src prep for demo 2024-07-09 01:55:51 +01:00
.gitignore clean demo repo 2024-06-25 12:25:51 +01:00
.yarnrc.yml yarn updates 2024-07-09 02:09:59 +01:00
README.md clean demo repo 2024-06-25 12:25:51 +01:00
biome.json clean demo repo 2024-06-25 12:25:51 +01:00
index.html clean demo repo 2024-06-25 12:25:51 +01:00
package.json try a thing 2024-07-09 02:24:47 +01:00
tsconfig.json clean demo repo 2024-06-25 12:25:51 +01:00
vite.config.ts try a thing 2024-07-09 02:24:47 +01:00
yarn.lock yarn updates 2024-07-09 02:09:59 +01:00

README.md

scoped proagators

"Scoped propagators" are formed of a scope and a propagator which often looks like this:

click { text: "foo" }

The scope sets the events that cause propagation, such as clicks, ticks, or shape changes (not adding a scope will default to shape changes).

The propagator is a JS object (or function which returns one) that is applied to the shape.

Notes

  • shapes are passed both from and to shapes.
  • Shapes are flattened before being passed to the propagator, and unpacked on the other side. So properties live alongside the x, y, and rotation values (e.g. { x: 100, y: 100, text: "foo" }).

Current Issues (probably should be fixed before putting out a demo):

  • cycles of change propagators cause infinite recursion.
  • geo scopes are currently fired for any shape change, this should be localised to spatially local changes.

Effects / Generic JS

You can create effects or run arbitrary JS code if you use the full function syntax:

click () { return { text: "foo" } }

This can be useful for larger propagators, or for doing arbitrary stuff with the editor.