Pixel Reveal

`<pura-pixel-reveal>` is the retro pixel-block transition: a shadow-DOM grid of square cells flickers in pseudo-random order to swap between two slotted states (default slot and `alt` slot) or, in `mode="reveal"`, to cover the content and snap off cell by cell, revealing it in pixel blocks. The scatter order is seeded deterministically per cell index (no Math.random), so server and client paint byte-identical grids and the whole effect runs on CSS keyframes and transitions with no per-frame JS. Trigger it by toggling the `active` attribute, by hover, or once on entering the viewport. Theme with `--pura-pixel-reveal-color` (cell color), `--pura-pixel-reveal-duration` (per-cell pop), and `--pura-pixel-reveal-stagger` (scatter spread); size the grid with `cols`/`rows`. SSR and pre-JS render state A fully visible with no cells shown; reduced motion skips the pixel pass and jumps straight to the final state. Each instance registers in `window.__puraPixelReveals` by `data-pura-id` with `{ mode, trigger, active, toggle }`.

Preview

Attributes

AttributeTypeDefaultDescription
mode "swap" | "reveal" swap swap replaces the default slot with the alt slot under a one-shot pixel burst; reveal covers the content with cells and snaps them off one by one.
trigger "attr" | "hover" | "view" attr attr toggles via the active attribute; hover toggles on pointer enter/leave (and focus); view activates once when scrolled into view.
active boolean false Current state: alt slot shown (swap) or content revealed (reveal). Kept in sync by hover/view triggers.
cols number 12 Pixel grid columns, capped at 32.
rows number 8 Pixel grid rows, capped at 32.

Installation

pura is copy-paste and dependency-free. Load the whole library, or just this component.

HTML
<link rel="stylesheet" href="/pura/tokens.css">
<script type="module" src="/pura/lib/pixel-reveal.js"></script>
JavaScript
import "./pura/lib/pixel-reveal.js";

Slots

defaultalt

Events

pura-pixel-reveal-toggle
esc
AccordionDisclosure ActionAgent AffixLayout Agent CursorTools Agent HintAgent Alert DialogOverlay AlertFeedback Angle SliderForm Animated BeamAnimation App ShellLayout Aspect RatioDisplay AsyncAgent AudioDisplay AuroraDisplay Auto AnimateUtility Avatar GroupDisplay AvatarDisplay Back to TopNavigation BadgeDisplay BannerFeedback BarcodeDisplay Background BeamsAnimation Bento GridAnimation Gooey BlobsAnimation BlockquotePrimitives Blur TextAnimation Border BeamDisplay Bottom NavigationNavigation BoxPrimitives BreadcrumbNavigation BubblesAnimation BurgerNavigation Button GroupForm ButtonForm CalendarDate Card StackAnimation CardDisplay CarouselLayout CascaderForm CenterPrimitives ChartDisplay Chat BubbleDisplay Chat InputForm CheckboxForm Cipher HoverAnimation Circular TextAnimation Click SparkAnimation Clip RevealAnimation Code BlockDisplay CodePrimitives CollapsibleDisclosure Color PickerForm ComboboxForm Command RegistryAgent CommandNavigation CommentDisplay ConfettiAnimation Confidence MeterDisplay Container ScrollAnimation ContainerLayout Context MenuOverlay Cookie ConsentOverlay Copy ButtonDisplay Copy RegionAgent Count UpDisplay CountdownFeedback Coverflow CarouselAnimation CronForm CrosshairAnimation CursorAnimation Data TableDisplay Date PickerDate Date Range PickerDate Datetime PickerDate DeckAnimation DialogOverlay Diff MotionUtility DiffUtility Direction HoverAnimation DisclosureLayout DockNavigation Dot PatternAnimation DrawAnimation DrawerOverlay Dropdown MenuOverlay Dynamic IslandAnimation EmphasisUtility EmptyDisplay Expand CardAnimation ExplainAgent Floating Action ButtonLayout Falling TextAnimation FAQDisclosure FieldForm File DropzoneForm FireworksAnimation FlashlightAnimation FlexPrimitives Flickering GridAnimation Flip CardAnimation Floating WindowOverlay Flow FieldAnimation FlowDisplay Fly To CartAnimation Focus HoverAnimation FolderAnimation FormForm Fuzzy TextAnimation Gallery 3DAnimation GaugeDisplay Glitch TextAnimation Gooey CursorAnimation Gradient TextAnimation Grid MotionAnimation Grid PatternDisplay GridPrimitives HeadingPrimitives HeatmapDisplay Hide-on-scroll BarAnimation HighlightDisplay Hold ConfirmAnimation Holo CardAnimation HotkeyAgent Hover CardOverlay Hover HighlightAnimation Hover UnderlineAnimation IconDisplay IdleAgent Image CompareLayout Image TrailAnimation ImagePrimitives Infinite ScrollUtility Inline EditForm Input GroupForm Input OTPForm InputForm InspectorUtility IntentAgent Interactive GridAnimation ItemDisplay Json InputForm KanbanLayout Keyboard ShortcutsOverlay KbdDisplay KnobForm LabelForm Lamp EffectAnimation LensAnimation Letter ShuffleAnimation Light RaysAnimation LightboxOverlay Line Shadow TextAnimation LinkPrimitives ListDisplay Live RegionAgent Magic CardDisplay Magnet LinesAnimation MagneticAnimation MapDisplay Markdown EditorForm Marquee 3DAnimation MarqueeDisplay Mask InputForm MasonryLayout Matrix RainAnimation Media QueryUtility MentionForm MenubarNavigation Animated Mesh GradientAnimation MeteorsDisplay MeterDisplay MorphAnimation Motion BudgetUtility Motion PathAnimation MotionUtility Narrated TransitionUtility Navigation MenuNavigation Noise / Film GrainAnimation Notification ItemDisplay Number InputForm OptimisticAgent Orbiting CirclesDisplay Organization ChartDisplay Overflow ListLayout OverlayOverlay PaginationNavigation Parallax ColumnsAnimation ParallaxMarketing Particle NetworkAnimation ParticlesDisplay Password InputForm Pdf ViewerDisplay Scroll PinAnimation Pinch ZoomAnimation Pixel RevealAnimation Pointer ParallaxAnimation PopconfirmOverlay PopoverOverlay PortalAgent PresenceDisplay Pricing TableMarketing Progress RingDisplay ProgressDisplay Progressive BlurAnimation TypographyDisplay Pull To RefreshFeedback Pulse RingsAnimation Qr CodeUtility Radio GroupForm RadioForm Range SliderForm RatingForm ReactionsDisplay RedactAgent ResizableLayout ResultFeedback Retro GridDisplay RevealUtility Rich TextForm RippleUtility ScrambleAnimation Scroll AreaNavigation Scroll HighlightAnimation Infinite Scroll LoopAnimation Scroll ProgressNavigation Scroll RevealUtility Scroll SpyNavigation Scroll TimelineUtility Scroll ZoomAnimation Search FieldForm SectionPrimitives Segmented ControlForm SelectForm SeparatorDisplay Sheen / Glare HoverAnimation SheetOverlay SidebarNavigation SignatureForm Skeleton TextDisplay SkeletonDisplay Skip NavNavigation SliderForm Smooth Scroll (lerp)Animation SnowAnimation SortableAnimation SpacerPrimitives Sparkles TextAnimation SparklineDisplay Speed DialOverlay SpinnerDisplay Split ButtonOverlay Split-Flap TextAnimation Split TextAnimation SpotlightOverlay SpringAnimation StackPrimitives StageAnimation Starfield / HyperspaceAnimation Stat GridDisplay StatDisplay Status BadgeAnimation Step LoaderAnimation StepperNavigation Sticky Scroll RevealAnimation Stream CascadeUtility Swatch PickerForm SwipeUtility SwitchForm TableDisplay TabsNavigation Tag InputForm TagDisplay TerminalDisplay TestimonialDisplay Text FillAnimation Text HighlighterAnimation Morphing TextAnimation Text PressureAnimation Text ShimmerDisplay TextPrimitives TextareaForm Theme DesignerUtility Animated Theme ToggleAnimation TickerDisplay TiltAnimation Time PickerDate Time ScrubUtility TimelineDisplay ToastFeedback Toggle GroupForm ToggleForm ToolbarNavigation TooltipOverlay TourOverlay Tracing BeamAnimation TransferForm Tree SelectForm Tree ViewDisplay True FocusAnimation TruncateUtility Type MorphAnimation TypewriterDisplay Typing IndicatorFeedback UndoFeedback UploadForm Vanish InputAnimation Scroll Velocity MarqueeAnimation VelocityAnimation Video TextAnimation VideoDisplay View TransitionUtility Virtual ListDisplay Visually HiddenPrimitives WatermarkDisplay Wavy BackgroundAnimation Wavy TextAnimation WipeAnimation Word RotateAnimation