propagate() — Group-Level Parameter Propagation

propagate(...) is a pre-parser macro that expands a cue or animation template across all direct children of an SVG <g> element. Each child receives a unique instance of the template with independently evaluated parameters.


Purpose

To apply variations of an animation or cue to multiple similar objects without manually writing separate IDs. Typical uses:

propagate(...) runs before cue/animation parsing and rewrites child element IDs into fully expanded DSL strings.


Syntax

propagate(
  TEMPLATE,
  ARG1,
  ARG2,
  ...
)

TEMPLATE

A new-DSL animation or cue definition, e.g.:

scale(values:[${1}, ${2}], mode:alternate, dur:${3}, uid:circs)

${n} placeholders

Inside the template, ${1}, ${2}, ${3}, ... are replaced with the evaluated values of ARG1, ARG2, ARG3, etc.

Each occurrence is evaluated independently, allowing fresh randomisation.


UID Handling

uid:prop_GROUPINDEX_CHILDINDEX

Example: uid:prop_3_2


Example

Group of 6 circles with unique scale range and timing between 1–2:

propagate(
  scale(values:[${1}, ${2}], mode:alternate, dur:${3}, uid:circs),
  rnd(1,2),        // ${1}: min scale
  rnd(1,2),        // ${2}: max scale
  rnd(0.4,1.2)     // ${3}: duration
)

Possible expanded IDs:

scale(values:[1.14,1.92], mode:alternate, dur:0.66, uid:circs_0)
scale(values:[1.83,1.21], mode:alternate, dur:1.07, uid:circs_1)
scale(values:[1.05,1.99], mode:alternate, dur:0.48, uid:circs_2)
...

Evaluation Rules

This enables effects like:

scale(values:[${1},${1}], dur:${2})

Where the two ${1} occurrences receive different random values.


Non-Recursive

Only direct children of the <g id="propagate(...)"> are expanded.

Nested groups are left as-is unless you manually apply propagate to them.


Execution Order

propagate(svgElement) must run before any animation or cue parsing, typically inside initializeSVG():

// Expand propagate(...) groups before parsing
propagate(svgElement);

If used in page overlays, it must run before animationAssign(...) and cue scanning.


Supported Contexts


When to Use

Use propagate(...) when:


When Not to Use

Avoid propagate when:


Notes


Version Compatibility

This documentation refers to the new Oscilla DSL (2025) with:


Tip: use ← → or ↑ ↓ to navigate the docs