Class: Vizcore::CLISupport::DslReference

Inherits:
Object
  • Object
show all
Defined in:
lib/vizcore/cli/dsl_reference.rb

Overview

Produces a generated reference for the Ruby DSL entrypoints.

Defined Under Namespace

Classes: Entry

Constant Summary collapse

TOP_LEVEL =
[
  Entry.new(syntax: "audio :mic, **options", description: "Register an audio input definition."),
  Entry.new(syntax: "midi :controller, **options", description: "Register a MIDI input definition."),
  Entry.new(syntax: "audio_normalize mode: :adaptive", description: "Configure analysis-level normalization."),
  Entry.new(syntax: "audio_analysis onset_sensitivity: 1.4, fft_bins: 64", description: "Tune analysis feature extraction."),
  Entry.new(syntax: "bpm 128 / bpm_lock true", description: "Set and optionally lock the analysis BPM."),
  Entry.new(syntax: "tap_tempo key: :space", description: "Enable browser tap tempo events."),
  Entry.new(syntax: "set :global_intensity, 0.8", description: "Set a runtime global exposed to shaders."),
  Entry.new(syntax: "style :name { ... } / theme :name { ... }", description: "Define reusable layer params or scene defaults."),
  Entry.new(syntax: "mapping :name { ... }", description: "Define reusable layer mapping groups."),
  Entry.new(syntax: "scene :name, extends: :base { ... }", description: "Define a scene and optional inherited layers."),
  Entry.new(syntax: "section :intro, bars: 8, loop: true, hold: 2, outro: false", description: "Define beat-counted scenes with optional auto-loop/outro/hold behavior."),
  Entry.new(syntax: "timeline { at beats(0), scene: :intro, cue: :prelude }", description: "Define ordered scene markers with optional cue metadata."),
  Entry.new(syntax: "transition from: :intro, to: :drop { ... }", description: "Define explicit scene transitions."),
  Entry.new(syntax: "midi_map cc: 1, channel: 1, deadband: 2, smooth: 0.25, allow_multiple: true { ... }", description: "Map MIDI events to runtime actions."),
  Entry.new(syntax: "key \"d\" { switch_scene :drop }", description: "Map browser keyboard shortcuts to runtime actions.")
].freeze
SCENE =
[
  Entry.new(syntax: "use_theme :name", description: "Apply scene-wide layer defaults."),
  Entry.new(syntax: "use_mapping :name", description: "Apply a reusable mapping group to a layer."),
  Entry.new(syntax: "group :foreground { layer :name { ... } }", description: "Apply shared params to a related layer group."),
  Entry.new(syntax: "layer :name { ... }", description: "Append a render layer to the scene.")
].freeze
LAYER =
[
  Entry.new(syntax: "type :particle_field", description: "Set the layer renderer type."),
  Entry.new(syntax: "shader :neon_grid / shader \"shaders/liquid.frag\"", description: "Use a built-in or custom fragment shader."),
  Entry.new(syntax: "glsl \"shaders/liquid.frag\"", description: "Load a custom fragment shader file."),
  Entry.new(syntax: "type :svg / file \"assets/logo.svg\"", description: "Render an SVG asset resolved relative to the scene file."),
  Entry.new(syntax: "type :image / file \"assets/noise.png\"", description: "Render a PNG/JPEG/GIF/WebP asset resolved relative to the scene file."),
  Entry.new(syntax: "type :video / file \"assets/loop.mp4\"", description: "Render a looping MP4/WebM/OGV video texture."),
  Entry.new(syntax: "type :waveform / source :audio / style :ribbon", description: "Render an audio feature waveform layer."),
  Entry.new(syntax: "type :spectrogram / scroll :vertical", description: "Render a scrolling FFT heatmap layer."),
  Entry.new(syntax: "type :mesh / geometry :icosahedron / material :wireframe", description: "Render preset 3D wireframe geometry."),
  Entry.new(syntax: "circle count: 8 { radius 100 } / rect width: 320, height: 160 / custom_shape :flower", description: "Render declarative and Ruby-generated 2D shape primitives."),
  Entry.new(syntax: "font \"Inter\" / letter_spacing 4", description: "Set text presentation params."),
  Entry.new(syntax: "palette \"#ff0055\", \"#00ffff\"", description: "Set ordered colors for supported layer renderers."),
  Entry.new(syntax: "hsl(240, 100, 50) / hsv(0, 100, 100)", description: "Generate CSS hex color values from HSL / HSV."),
  Entry.new(syntax: "gradient(type: :radial, colors: [\"#f00\", \"#0ff\"])", description: "Build reusable gradient descriptors for color fields."),
  Entry.new(syntax: "grid(count: 12, columns: 4, spacing: 20)", description: "Generate point layouts for shape geometry."),
  Entry.new(syntax: "radial(count: 16, radius: 120, start_angle: -90)", description: "Generate polar layout points."),
  Entry.new(syntax: "spiral(count: 24, radius: 150, turns: 4)", description: "Generate expanding spiral points."),
  Entry.new(syntax: "circle_pack(count: 20, radius: 140)", description: "Generate packed points in concentric circles."),
  Entry.new(syntax: "scatter(count: 12, width: 320, height: 180, seed: 7)", description: "Generate deterministic scattered point layouts."),
  Entry.new(syntax: "blend :add / effect :bloom / vj_effect :mirror", description: "Set compositing and browser effects."),
  Entry.new(syntax: "post :bloom / post :motion_blur / post :chromatic", description: "Build a post effect chain for a layer."),
  Entry.new(syntax: "param :wobble, default: 0.3, range: 0.0..2.0", description: "Declare numeric shader parameter metadata."),
  Entry.new(syntax: "map amplitude, to: :speed, range: 0.0..2.0", description: "Map audio features to layer params."),
  Entry.new(syntax: "react_to bass { change :size }", description: "Group mappings by source.")
].freeze
SOURCES =
[
  "amplitude",
  "frequency_band(:low)",
  "frequency_band_peak(:low)",
  "sub",
  "low",
  "bass",
  "bass_peak",
  "mid",
  "mid_peak",
  "high",
  "high_peak",
  "treble",
  "fft_spectrum",
  "onset",
  "onset(:high)",
  "kick",
  "snare",
  "hihat",
  "beat?",
  "beat",
  "beat_confidence",
  "beat_pulse",
  "beat_count",
  "adsr(:kick, attack: 0.02, decay: 0.08, sustain: 0.7, release: 0.16, threshold: 0.0, peak: 1.0)",
  "envelope(:kick, attack: 0.02)",
  "beat_phase",
  "beat_2",
  "beat_4",
  "beat_8",
  "triplet",
  "bar_phase",
  "bar_count",
  "phrase_count",
  "bpm"
].freeze
TRANSFORMS =
[
  "as(:trigger)",
  "gain",
  "range",
  "min",
  "max",
  "curve",
  "deadzone",
  "threshold",
  "hysteresis",
  "hold",
  "decay",
  "cooldown",
  "one_shot",
  "smooth(attack:,release:)"
].freeze

Instance Method Summary collapse

Instance Method Details

#linesArray<String>

Returns:

  • (Array<String>)


118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/vizcore/cli/dsl_reference.rb', line 118

def lines
  [
    "# Vizcore Ruby DSL Reference",
    "",
    "## Top-level DSL",
    *entry_lines(TOP_LEVEL),
    "",
    "## Scene DSL",
    *entry_lines(SCENE),
    "",
    "## Layer DSL",
    *entry_lines(LAYER),
    "",
    "Mapping sources: #{SOURCES.join(', ')}",
    "Mapping transforms: #{TRANSFORMS.join(', ')}",
    "",
    "## Built-in Layer Capabilities",
    *capability_lines
  ]
end