Visual feedback effects
Visual feedback effects add motion, light, or celebration to a Phoenix component without carrying the meaning of status on their own. They help a user notice an important moment, focus on a key surface, or read changing promotional text while keeping the main content available in the rendered page. For status messages and live announcements, see Notifications and alerts; this page is about decorative and attention-guiding effects.
Effect families
The effect set covers short event feedback, animated surfaces, background decoration, moving content, and animated text. Each component wraps content or mounts at a target location, so an application can add visual interest without changing the surrounding page structure.
| Effect | Primary role | Motion model | Best fit |
|---|---|---|---|
| Confetti | Celebrate a completed action | Temporary full-screen burst | Success moments such as onboarding or payment completion |
| Border beam | Draw attention to a surface | Light travels around the border | A key card, call to action, or sign-in panel |
| Border plasma | Keep a surface active and vivid | Glowing border field pulses or rotates | A hero panel or one high-value call to action |
| Shine border | Add quiet activity to an edge | Slow shimmer around the border | Cards, inputs, or low-priority calls to action |
| Aurora | Set a soft backdrop behind content | Blurred light drifts across a section | Hero sections and landing-page content |
| Meteors | Add depth to a dark surface | Streaks cross the containing panel | A hero or card background |
| Marquee | Show a repeated stream of content | Content loops in one direction | Logos, reviews, or other repeated items |
| Text animation | Emphasize or reveal words | Gradient, shimmer, word change, or typing | Headings and short promotional text |
References: lib/…/confetti.ex• L1-28 lib/…/border_beam.ex• L1-7 lib/…/border_plasma.ex• L1-30 lib/…/shine_border.ex• L1-10 lib/…/aurora.ex• L8-30 lib/…/meteors.ex• L1-9 lib/…/marquee.ex• L1-30 lib/…/text_animation.ex• L1-14
Surface effects
Border beam, border plasma, and shine border all decorate a panel edge, but they signal different levels of attention. Border beam presents a distinct moving light. Border plasma presents a wider field of changing light. Shine border stays slow and quiet so the content remains the focus.
Border beam
PetalComponents.BorderBeam wraps a content panel and moves one or more colored beams around its border. It is a CSS-only effect, so it does not need a browser hook. The panel owns its background, border, and radius, while the beam remains a visual layer around the content.
The component supports linear motion, eased motion, and a spring-like lap. It can reverse direction or use a soft glow. Multiple beams are phased around the same path to create a chase rather than several beams starting together.
References: lib/…/border_beam.ex• L1-7 lib/…/border_beam.ex• L17-62 lib/…/border_beam.ex• L64-87
Border plasma
PetalComponents.BorderPlasma wraps content in a glowing border field. Its pulse mode makes the light breathe in place. Its rotate mode moves a light arc around the rim. Palettes and intensity levels let the effect fit a brand or remain neutral.
The glow can sit outside the panel, inside its edge, or in both places. Because this effect paints several blurred layers, it is intended for a small number of important surfaces rather than every card in a view.
References: lib/…/border_plasma.ex• L1-30 lib/…/border_plasma.ex• L38-87 lib/…/border_plasma.ex• L89-114
Shine border
PetalComponents.ShineBorder adds a slow ambient shimmer to a bordered panel. It is the quietest of the three border effects and works when a surface needs a hint of motion without competing with its content.
The shimmer accepts one color or a list of colors. It can wrap form controls while preserving a visible keyboard focus outline, so the decorative edge does not replace an interaction signal.
References: lib/…/shine_border.ex• L1-10 lib/…/shine_border.ex• L13-28 assets/default.css• L5981-6032
Background effects
Aurora and meteors provide motion behind content instead of on the content boundary. Both are non-interactive visual layers. The containing layout must leave the foreground content readable and must define the space in which the effect can render.
Aurora
PetalComponents.Aurora creates a soft color glow behind a section. It builds the glow from a supplied palette and can adapt its light or dark treatment to the page. The content stays above the backdrop, so the effect enriches a hero without replacing its text or controls.
The optional PetalAurora hook pauses the drift when the section is outside the viewport. Reduced-motion users see a still glow instead of the drift.
References: lib/…/aurora.ex• L8-30 lib/…/aurora.ex• L31-56 assets/…/petal_components.js• L2007-2020 assets/default.css• L6034-6123
Meteors
PetalComponents.Meteors fills the nearest relative container with colored streaks. It is suited to a dark hero or card background and does not receive pointer input. The parent container must provide the positioning context and clip the shower when needed.
The component derives a stable scatter pattern from its seed. LiveView re-renders therefore keep each meteor in the same place instead of making the background jump. The count, direction, color, and horizontal direction control the visual density and flow.
References: lib/…/meteors.ex• L1-9 lib/…/meteors.ex• L12-32 lib/…/meteors.ex• L34-44 assets/default.css• L6744-6764
Repeating content effects
PetalComponents.Marquee turns repeated content into a continuous horizontal or vertical stream. It repeats the supplied slot so the moving track can cycle without an empty gap, and it can fade the track at its edges to soften the loop.
The marquee can reverse direction, pause while the user hovers, and limit its width or height. These options control how the stream fits the page; they do not change the meaning of the repeated content.
References: lib/…/marquee.ex• L1-30 lib/…/marquee.ex• L32-63 assets/default.css• L3866-3985
Text effects
PetalComponents.TextAnimation provides four ways to add motion to short text. Gradient text and shimmer text use CSS only. Word rotation and the typing effect use browser hooks, but both render useful text on the server first so the message remains present without JavaScript.
| Text effect | User-visible behavior | Runtime requirement |
|---|---|---|
| Gradient text | A color gradient sweeps through the text | CSS |
| Shimmer text | A bright band passes over muted text | CSS |
| Word rotate | A list of words changes with a roll-up transition | PetalWordRotate hook |
| Typing effect | Text appears one character at a time with an optional caret and loop | PetalTypingEffect hook |
These effects suit headings and short labels. The server-rendered first word and full typing text provide a readable fallback, while reduced-motion users keep static text and do not receive the timed animation.
References: lib/…/text_animation.ex• L1-14 lib/…/text_animation.ex• L17-73 lib/…/text_animation.ex• L75-151 assets/…/petal_components.js• L1176-1244 assets/default.css• L6766-6814 assets/default.css• L7661-7676
Motion and accessibility
The effects treat motion as optional decoration, not as the only way to convey information. CSS animation stops or becomes static under prefers-reduced-motion, and the browser-driven effects check the same preference before starting. Confetti skips the burst, while the text and background content remain available.
Decorative layers are marked as hidden from assistive technology where they do not carry content. Confetti also uses a pointer-free full-screen canvas for its temporary burst. Use an alert, toast, or live region when a user must receive a status message rather than only see a visual change.
The main behavior is:
flowchart TD
A[Component renders content] --> B{Effect needs browser timing or events?}
B -->|No| C[CSS animation decorates the content]
B -->|Yes| D[Server-rendered fallback remains visible]
D --> E[Browser hook adds motion or event response]
C --> F{Reduced motion requested?}
E --> F
F -->|Yes| G[Keep content and remove or stop motion]
F -->|No| H[Run the visual effect]
References: lib/…/confetti.ex• L7-28 lib/…/text_animation.ex• L12-14 assets/…/petal_components.js• L1047-1089 assets/…/petal_components.js• L1180-1192 assets/…/petal_components.js• L1217-1231 assets/default.css• L6114-6117 assets/default.css• L7661-7676
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the server event name and client event listener aligned for confetti. A mismatch makes a successful event produce no burst.
- Keep hook names and rendered mount attributes aligned for confetti, aurora, word rotation, and typing. A renamed hook or missing data value can remove only the enhanced behavior while leaving the fallback visible.
- Keep reduced-motion behavior aligned between CSS animation rules and hook start logic. Otherwise one part of an effect can continue after the rest becomes static.
- Keep the parent positioning and clipping contract for meteors. Changing the container structure can move the shower over content or let it escape its intended area.
- Treat border plasma paint cost and glow clearance as part of its layout contract. More instances or less room in a scrolling container can affect page performance or scroll range.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| Confetti is fired without the matching mounted target or with a different target ID | No burst appears at the intended mount | Mount the required confetti component and use its ID when several mounts exist |
| A hook-based text effect receives no usable text or fewer than two words | The effect cannot animate, while its server-rendered fallback remains | Supply the required text or a list with at least two words |
| Meteors render outside a relative, clipped parent | Streaks can cover unrelated content or escape the visual region | Place the effect in the nearest relative container and clip that region when needed |
| Many border plasma instances run on one view | Several blurred animated layers can raise paint cost and reduce smoothness | Reserve plasma for a hero panel or a small number of key calls to action |
| A user has reduced motion enabled | Confetti and meteor motion are skipped, and other effects stay still | Keep the meaning in text or standard status components rather than in animation |
Key files
| File | Why to read it |
|---|---|
lib/petal_components/confetti.ex | Defines the celebration mount and the server and client ways to trigger a burst. |
lib/petal_components/border_beam.ex | Defines the moving border treatment and its attention levels. |
lib/petal_components/border_plasma.ex | Defines the richer pulsing or rotating border field and its usage limits. |
lib/petal_components/shine_border.ex | Defines the low-attention border shimmer and its form-control focus behavior. |
lib/petal_components/aurora.ex | Defines the hero backdrop and its palette and motion choices. |
lib/petal_components/meteors.ex | Defines the container-bound streak field and stable scatter behavior. |
lib/petal_components/marquee.ex | Defines the repeated horizontal or vertical content stream. |
lib/petal_components/text_animation.ex | Defines the four text treatments and their fallback model. |
| assets/…/petal_components.js | Shows the browser event, timing, viewport, and reduced-motion behavior for hook-backed effects. |
| assets/default.css | Shows the shared visual rules, animation states, edge placement, and reduced-motion rules. |