Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

1.2 KB
Raw Blame
import { defineComponent, defineTag } from 'esengine';

// A drum pad. `index` selects its sample; `cooldown` debounces retriggers.
export const Pad = defineComponent('Pad', { index: 0, cooldown: 0 });

export const EventPad = defineComponent('EventPad', { index: 0 });
export const EventStatusLabel = defineTag('EventStatusLabel');

// The looping-beat toggle button, and its live On/Off label.
export const BeatToggle = defineTag('BeatToggle');
export const BeatLabel = defineTag('BeatLabel');

// A bus-volume button: clicking cycles `bus`'s volume. VolumeLabel is the live
// percentage readout for the same bus.
export const VolumeKnob = defineComponent('VolumeKnob', { bus: 'master', volume: 1 });
export const VolumeLabel = defineComponent('VolumeLabel', { bus: 'master' });

// A spectrum bar: reads analyser bin `index` each frame to set its height.
export const VisualizerBar = defineComponent('VisualizerBar', { index: 0 });

// The spatial source's orbit around the listener: `radius` its half-width,
// `speed` radians per second. The AudioSource riding it is authored in the
// scene — this only moves the entity, which is what makes the sound move.
export const Orbiting = defineComponent('Orbiting', { radius: 320, speed: 0.6 });