View Source Fledex.Effect.Interface behaviour (fledex v0.3.0)

This module defines the interface for an LED effect. Effects can be used in Animations. Examples are:

  • Rotation
  • Dimming
  • Randomize
  • Wanishing
  • Blinking
  • etc.

Summary

Callbacks

Applies an effect to the list of LEDs.

Callbacks

Link to this callback

apply(leds, count, config, triggers)

View Source
@callback apply(
  leds :: [Fledex.Color.Types.colorint()],
  count :: non_neg_integer(),
  config :: keyword(),
  triggers :: map()
) :: [Fledex.Color.Types.colorint()] | {[Fledex.Color.Types.colorint()], map()}

Applies an effect to the list of LEDs.

Every LED in the list can be modified at will, however, the amount should NOT be changed. The function can either return a list of LEDs (color integers) or a tuple with the first part being the LEDs and the second being a modified triggers map. This allows to retain some state between applying the filter in consecutive calls. The count is the amount of LEDs in the list (to avoid that we have to traverse it unnecessarily)