You are reading the development docs (2026.12.1-dev.1): features here may not be released yet.
Skip to content

Card Animations ​

Animations make a card move: a pulse when you tap it, a glow while a light is on, a slide-in when a view opens. Every LCARdS card takes an animations list. Each entry names a preset (what moves) and a trigger (when it plays).

  • A card can have as many entries as you like, each with its own trigger. An entry without trigger plays when the card loads.
  • Each preset has its own duration, easing and looping; set duration, loop or ease on the entry to change them.
  • When the device asks for less motion, animations jump to their end or stay still: see Reduced motion.

Try it

  • The button and elbow editors have an animation editor on the Effects tab, with a field for every option on these pages; the data grid and MSD studios have one too.
  • Every example here is live: tap the cards.
PageCovers
TriggersTaps, holds, hover, on load, entrances with on_show, data source changes
Entity Change TriggersPlay on a state change, loop while a condition holds, follow an attribute
Timing and EasingDuration, delay, loops, numbers that follow an entity (map_range), easing, reduced motion
Rule-based AnimationsAnimate many cards at once from a rule
Preset ReferenceEvery built-in preset and its params

Quick start ​

Two entries to start from: a bounce on every tap, and a pulse that runs while the light is on. Tap the card to switch the light and watch the pulse start and stop.

  • params holds the preset's own settings, here how far the pulse grows. The Preset Reference lists them for each preset.
yaml
type: custom:lcards-button
entity: light.workbench
preset: lozenge
text:
  name:
    show: true
tap_action:
  action: toggle
animations:
  # a quick bounce on every tap
  - trigger: on_tap
    preset: bounce
    duration: 400
    params:
      scale_max: 1.08
      bounces: 2
  # a pulse while the light is on
  - trigger: on_entity_change
    entity: light.workbench
    preset: pulse
    loop: true
    while:
      state: "on"
    params:
      max_scale: 1.05

Available presets ​

preset picks what the animation does. Each name links to its parameters and defaults in the Preset Reference.

CategoryPresets
Motionbounce, blink, fade, glow, pulse, rotate, scale, scale-reset, shake, skew, slide, strobe
Colourcascade-color, color-shift, shimmer
Texttext-glitch, text-reveal, text-decode, text-scramble, text-typewriter
Visual effectscascade, flicker, glitch, ripple
SVGdraw, march, morph
Staggerstagger-grid, stagger-wave, stagger-radial, stagger-flash, tap-ripple
Effectsboot-sequence, sensor-sweep
Timelinetimeline-cascade, timeline-attention, sequence
Advancedchaos, physics-spring
Utilitymotionpath, set, custom

Targets ​

Without a target an animation moves the whole card; target or targets picks parts of it, such as one text field. Use it to scramble just the label, or blink just the state.

  • The selector is a CSS selector looked for inside the card. Text fields carry data-field-id with their name, so [data-field-id='name'] is the name text.
  • target animates every element the selector matches; targets takes a list of selectors and animates the first match of each.
  • target: background animates the card's background animations instead of its elements; effect picks one of them.
yaml
type: custom:lcards-button
entity: light.workbench
preset: lozenge
text:
  name:
    show: true
  state:
    show: true
    content: "{entity.state}"
    position: center
tap_action:
  action: toggle
animations:
  # only the state text blinks when you tap
  - trigger: on_tap
    preset: blink
    target: "[data-field-id='state']"
    loop: 3
    duration: 200
More about targets
  • A selector that matches nothing: the animation still plays, on the whole card, with a warning in the browser console.
  • SVG elements with their own transform: an element with its own transform (common in SVGs exported from Inkscape, such as MSD base images) keeps it, so it stays exactly where it was drawn. A scale, rotate or pulse animation on a rotated or scaled group then turns about a point slightly off the group's centre. Colour, opacity, stroke and draw animations are not affected.
  • MSD overlays: on an MSD, a line or shape picks its drawn part by itself; see MSD Animations and Rules.
KeyTypeDefaultDescription
targetstringthe whole cardCSS selector for the elements to animate, or background for the card's background animations
targetsstring / list-One or more CSS selectors; the first element each one matches is animated
effectnumberevery effectWith target: background: the index of the background_animation entry to animate (0 is the first, the bottom layer)

Putting it together ​

One button with an entrance, tap feedback, a hover glow and two entity animations. Hover over it with a mouse, tap it, and watch the light switch on and off.

yaml
type: custom:lcards-button
entity: light.workbench
preset: lozenge
text:
  label:
    show: true
    content: Workbench
    position: top-left
  state:
    show: true
    content: "{entity.state}"
    position: center
tap_action:
  action: toggle
animations:
  # entrance: fades in once when the card loads
  - trigger: on_load
    preset: fade
    duration: 800
    params:
      from: 0
      to: 1
  # tap feedback: a quick bounce
  - trigger: on_tap
    preset: bounce
    duration: 400
    params:
      scale_max: 1.08
      bounces: 2
  # hover: glows while the mouse is over the card
  - trigger: on_hover
    preset: glow
    params:
      color: var(--lcars-orange)
      blur_max: 12
  # pulses while the light is on
  - trigger: on_entity_change
    entity: light.workbench
    preset: pulse
    loop: true
    while:
      state: "on"
    params:
      max_scale: 1.05
  # dims and comes back once when the light turns off
  - trigger: on_entity_change
    entity: light.workbench
    to_state: "off"
    preset: fade
    duration: 300
    loop: 1
    alternate: true
    params:
      from: 1
      to: 0.7

Animation options ​

Every key an animation entry takes, on every LCARdS card. The same entries go in an MSD's animations lists; a rule's apply.animations takes a smaller set (Rule-based Animations).

  • duration, delay, loop, alternate and ease can also sit inside params; the entry's own key wins when both are set.
yaml
type: custom:lcards-button
preset: lozenge
text:
  name:
    content: Options
    show: true
animations:
  - id: tap-glow
    trigger: on_tap
    preset: glow
    duration: 600
    delay: 100
    loop: 2
    alternate: true
    ease: inOutSine
    params:
      color: var(--lcars-yellow)
More about animation options
  • Unrecognised keys warn, they don't block. A key the animation or its params doesn't know (a leftover from switching preset, say) gives a console warning but never stops the card loading. Only a wrong type on a key it does know (duration: fast) is an error. Clear leftovers anyway: some presets read params differently depending on what else is there.
KeyTypeDefaultDescription
presetstringrequiredWhat the animation does: see Available presets
triggerstringon_loadWhen it plays: see Triggers
paramsobjectthe preset's defaultsThe preset's own settings: see the Preset Reference. Each value may be a map_range
idstring-A name for the entry, for debugging: letters, digits, - and _
enabledbooleantruefalse keeps the entry but never plays it
durationnumber / objectthe preset'sLength of one play, ms, or a map_range: see Timing
delaynumber / object0Wait before it starts, ms, or a map_range
loopboolean / numberthe preset'strue repeats for ever, false plays once, a number repeats that many more times
alternatebooleanthe preset'sPlay every other repeat backwards
easestring / objectthe preset'sThe easing curve: see Easing
essential_motionbooleanfalseKeep playing when the device asks for reduced motion: see Reduced motion
targetstringthe whole cardWhat to animate: see Targets
targetsstring / list-Several things to animate: see Targets
effectnumberevery effectWith target: background: which background animation
entitystring-on_entity_change: the entity to watch: see Entity Change Triggers
attributestringthe stateon_entity_change: an attribute to watch instead of the state; brightness_pct gives a light's brightness as 0–100
from_statestring-on_entity_change: play only when the value changes from this
to_statestring-on_entity_change: play only when the value changes to this
whileobject-on_entity_change: play while this holds and stop when it no longer does: see while
check_on_loadbooleantrueon_entity_change: also check the entity when the card loads
datasourcestring-on_datasource_change: the data source to watch: see on_datasource_change

Released under the MIT License. | About