Abstract
The options interface this pattern uses
Update pattern options without recreating the pattern instance. Override this method if your pattern has expensive initialization that should be preserved.
partial options to update
Abstract
generateGenerate characters for the given context. May render outside visible area for effects like blur or particle systems.
current rendering context with time, mouse position, etc.
Array of characters to render with their positions and properties
Called when the pattern is initialized or resized. Use this to set up any internal state or precompute values.
the rendering region including visible area and padding.
Called when the pattern is destroyed. Use this to clean up resources, cancel timers, etc.
Abstract
updateUpdate pattern state between frames.
Called before generate()
on each frame.
current rendering context.
Handle mouse interactions with the pattern. Override to implement custom mouse effects.
mouse X position relative to canvas.
mouse Y position relative to canvas.
Whether mouse was clicked this frame.
Static
Readonly
IDUnique identifier for the pattern, that should be overridden in subclasses.
Protected
_Options for the pattern, initialized with default values.
Protected
_Flag indicating if the pattern needs to be re-rendered. This is set to true when pattern options change in a way that required re-render (e.g. color change).
Base class for all pattern generators in ASCIIGround.
This abstract class provides the foundation for creating animated ASCII patterns. It handles option management, lifecycle methods, and defines the interface that all patterns must implement.
Patterns are responsible for generating arrays of CharacterData objects that define what characters to render and where. The base class handles common functionality like option updates and dirty state tracking.
Example: Creating a custom pattern