RGBMatrix.Animation behaviour (rgb_matrix v0.1.0) View Source
Provides the behaviour and interface for working with animations.
Link to this section Summary
Functions
Defines a configuration field for an animation.
Gets the current configuration and the configuration schema from an animation.
Sends an interaction event to an animation.
Returns an animation's initial state.
Returns the next state of an animation based on its current state.
Returns a human-readable name for an animation type.
Returns a list of the available types of animations.
Updates the configuration of an animation and returns the updated animation.
Link to this section Types
Specs
animation_state() :: any()
Specs
render_in() :: non_neg_integer() | :never | :ignore
Specs
t() :: %RGBMatrix.Animation{ config: RGBMatrix.Animation.Config.t(), state: any(), type: type() }
Specs
type() :: RGBMatrix.Animation.Breathing | RGBMatrix.Animation.CycleAll | RGBMatrix.Animation.HueWave | RGBMatrix.Animation.Pinwheel | RGBMatrix.Animation.RandomSolid | RGBMatrix.Animation.RandomKeypresses | RGBMatrix.Animation.SolidColor | RGBMatrix.Animation.SolidReactive | nil
Link to this section Functions
Defines a configuration field for an animation.
Example:
field :speed, :integer,
default: 4,
min: 0,
max: 32,
doc: [
name: "Speed",
description: """
Controls the speed at which the wave moves across the matrix.
"""
]
Specs
get_config(animation :: t()) :: {RGBMatrix.Animation.Config.t(), RGBMatrix.Animation.Config.schema()}
Gets the current configuration and the configuration schema from an animation.
Specs
interact(animation :: t(), led :: KeyboardLayout.LED.t()) :: {render_in(), t()}
Sends an interaction event to an animation.
Specs
new(animation_type :: type(), leds :: [KeyboardLayout.LED.t()]) :: t()
Returns an animation's initial state.
Specs
render(animation :: t()) :: {render_in(), RGBMatrix.Engine.frame(), t()}
Returns the next state of an animation based on its current state.
Specs
Returns a human-readable name for an animation type.
Specs
types() :: [type(), ...]
Returns a list of the available types of animations.
Specs
update_config( animation :: t(), params :: RGBMatrix.Animation.Config.update_params() ) :: t()
Updates the configuration of an animation and returns the updated animation.
Link to this section Callbacks
Specs
interact( state :: animation_state(), config :: RGBMatrix.Animation.Config.t(), led :: KeyboardLayout.LED.t() ) :: {render_in(), animation_state()}
Specs
new(leds :: [KeyboardLayout.LED.t()], config :: RGBMatrix.Animation.Config.t()) :: animation_state()
Specs
render(state :: animation_state(), config :: RGBMatrix.Animation.Config.t()) :: {render_in(), [RGBMatrix.any_color_model()], animation_state()}