color() (alias: colour()) animates the visual colour of SVG elements over time.
It supports discrete sequences, smooth tweening, and continuous traversal of HSL colour space,
using the same structural conventions as other Oscilla animation cues (scale, rotate, o2p).
Both spellings are fully equivalent:
color(...) ≡ colour(...)
fill and stroke propertiescolor(
uid:target,
vals:[...],
dur:seconds,
mode:mode,
loop:n
)
All parameters are optional unless stated otherwise.
Target SVG element(s). If omitted, applies to the element on which the cue is defined.
Supports wildcards (e.g. bars*).
Defines the colour values or colour behaviour.
Supported formats:
#f00, #ff8800)rgb(255,0,0))hsl(120,80%,50%))red, cyan)Examples:
color(vals:[#f00,#0f0], dur:2)
color(vals:[#f00,#ff0,#0ff], dur:6)
color(vals:Pseq([#f00,#ff0,#0ff],3), dur:3)
color(vals:Prand([#f80,#08f],inf), dur:1.2)
Behaviour:
color(vals:hue, dur:6)
dur defines time per full cycleRange-limited cycle:
color(vals:hue(120,240), dur:4)
Infinite cycle:
color(vals:hue, dur:8, loop:0)
color(vals:sat(40,90), dur:5)
color(vals:light(30,70), dur:8)
Duration in seconds for one full pass through vals.
Controls interpolation behaviour.
linear (default): smooth interpolationalt: ping-pong (forward then reverse)step: hard switching, no interpolationExamples:
color(vals:[#f00,#0f0], dur:2, mode:alt)
color(vals:[#f00,#0f0,#00f], dur:3, mode:step)
Number of repetitions.
loop:3 // repeat three times
loop:0 // infinite
Discrete colour melody:
color(vals:[#f00,#ff0,#0ff], dur:6)
Alternating palette:
color(vals:[#f80,#08f], mode:alt, dur:1.2)
Continuous hue field:
colour(vals:hue, dur:10, loop:0)
Cycle then land:
color(vals:hue, dur:8, loop:1)
color(vals:#f00, dur:1)