Light Effects¶
lifx-async includes 25+ software effects: from simple pulse and color loops to complex animations like aurora, flicker, fireworks, and cellular automata. The effects framework handles state management automatically: it captures your lights' current state, runs the effect, and restores everything when done.
Quick Example¶
import asyncio
from lifx import discover, DeviceGroup
from lifx.effects import Conductor, EffectPulse
async def main():
devices = []
async for device in discover():
devices.append(device)
group = DeviceGroup(devices)
if not group.lights:
print("No lights found")
return
# Create a conductor to manage effects
conductor = Conductor()
# Blink all lights 5 times
effect = EffectPulse(mode='blink', cycles=5)
await conductor.start(effect, group.lights)
# Wait for effect to complete
await asyncio.sleep(6)
print("Done - lights restored to original state")
asyncio.run(main())
How It Works¶
- Create a Conductor — the central orchestrator for all effects
- Create an Effect instance with your desired parameters
- Call
conductor.start(effect, lights)to run it - The conductor captures state, runs the effect, and restores state when done
Effects complete in different ways:
- Cycle-based (Pulse) — completes after configured cycles
- Duration-based (Sunrise, Sunset) — completes after a set duration
- Continuous (ColorLoop, Rainbow, Flicker, Aurora): runs until
conductor.stop()is called
Effects on One Light¶
For a single light you don't need a Conductor. start_effect() runs a software effect on that
light alone, with the same state capture and restore, and stop_effect() stops it:
from lifx.effects import EffectColorloop
await light.start_effect(EffectColorloop())
await asyncio.sleep(10)
await light.stop_effect()
stop_effect() stops every effect on the light: a running firmware effect such as Morph or
Move, and any software effect the light is part of, however it was started. If the light is one
of several participants in a Conductor run, it leaves that run and the other lights carry on.
Starting an effect on a light that already runs one replaces it, wherever it was started, with
no flash back to the light's earlier state. start_effect() takes software effects only; firmware effects keep their own API, such as
set_effect().
A light component, such as a Ceiling's ceiling.downlight or a Mirror's mirror.front, is an
effect participant too, with its own start_effect() and stop_effect(); see
Ceiling lights and
Mirror lights.
Software Effects¶
| Category | Effects |
|---|---|
| Basic | Pulse (blink/breathe/strobe), ColorLoop, Rainbow |
| Ambient | Flicker, Aurora, Twinkle, Embers, Sunrise, Sunset |
| Physics | Wave, Sine, Pendulum Wave, Double Slit, Ripple, Newton's Cradle |
| Generative | Rule 30, Rule Trio, Plasma, Plasma 2D, Spectrum Sweep |
| Visual | Cylon, Spin, Fireworks, Jacob's Ladder, Sonar, Progress |
See the Effects Gallery for animated previews of every effect.
Next Steps¶
- Effects Guide — Full usage guide with all effects, patterns, and best practices
- Effects Gallery — Animated GIF previews of every effect
- Custom Effects — Create your own effects
- Effects Reference — Complete API documentation