Styles and Defines

Styles and templates reduce repetition. Define a set of properties once, then apply them across your entire script.

Named Styles

A define style block creates a reusable collection of element settings.

text
define style heading
  size: display
  weight: heavy
  case: upper
  color: primary
  enter: rise

define style caption-text
  size: caption
  color: muted
  enter: fade

Apply a style to any element with style::

text
Scene "Intro"
  show "Chapter One"
    style: heading
  then show "The beginning of everything."
    style: caption-text

Element-level settings override style values. If you apply style: heading but also set size: hero, the element uses hero — the explicit setting wins.

Scene Templates

A define template block creates a reusable scene layout with variable placeholders. Variables use {curly_braces}.

text
define template chapter-card [5s]
  background: dark
  show "{title}"
    style: heading
  beat
  show "{subtitle}"
    size: caption
    color: muted

The duration in brackets ([5s]) is optional — if omitted, the compiler calculates duration from content.

Using Templates

Instantiate a template with Scene "name" from template-name:

text
Scene "Ch1" from chapter-card
  title: "The Beginning"
  subtitle: "Where it all started"

Scene "Ch2" from chapter-card
  title: "The Middle"
  subtitle: "Where it got interesting"

Both scenes share the same layout, animation, and timing. Only the text content differs.

Built-in Templates

Workshop includes five starter templates: product-launch, quarterly-report, social-promo, chapter-card, and testimonial. List available templates with the Templates API.

Organizing Styles

Place define style and define template blocks at the top of your .ws file, before the Film block. This keeps all reusable definitions in one place.

text
define style heading
  size: display
  weight: heavy

define template feature-card [5s]
  show "{title}"
    style: heading
  show "{description}"
    size: body

Film "Product Tour"
  mood: confident

Scene "Feature 1" from feature-card
  title: "Lightning Fast"
  description: "Render 10,000 videos without breaking a sweat."

Next Steps