Frosted Glass Wipe
framecn/frosted-glass-wipeFreeComponent
Elegant scene transition through a sliding pane of frosted glass.
Install it
npx shadcn@latest add https://framecn.dev/r/frosted-glass-wipe.jsonSource
1"use client";23import { Timegroup } from "@editframe/react";4import type { ReactNode, CSSProperties } from "react";56const FONT_FAMILY =7 "var(--font-geist-sans), -apple-system, BlinkMacSystemFont, sans-serif";89const DefaultPanel = ({ label, color }: { label: string; color: string }) => (10 <div11 style={{12 alignItems: "center",13 background: color,14 color: "white",15 display: "flex",16 fontFamily: FONT_FAMILY,17 fontSize: 96,18 fontWeight: 700,19 inset: 0,20 justifyContent: "center",21 letterSpacing: "-0.05em",22 position: "absolute",23 }}24 >25 {label}26 </div>27);2829export interface FrostedGlassWipeProps {30 from?: ReactNode;31 to?: ReactNode;32 transitionStart?: number;33 transitionDuration?: number;34 glassBlur?: number;35 speed?: number;36 fps?: number;37 durationInFrames?: number;38 width?: number;39 height?: number;40 background?: string;41 className?: string;42}4344export const FrostedGlassWipe = ({45 from,46 to,47 transitionStart = 36,48 transitionDuration = 30,49 glassBlur = 24,50 speed = 1,51 fps = 30,52 durationInFrames = 90,53 width = 1280,54 height = 720,55 background = "black",56 className,57}: FrostedGlassWipeProps) => {58 const safeSpeed = Math.max(0.01, speed);59 const durationMs = (durationInFrames / fps) * 1000;60 const frameMs = 1000 / fps;61 const startMs = transitionStart * frameMs;62 const durationMsCalc = (transitionDuration * frameMs) / safeSpeed;6364 const fromContent = from ?? <DefaultPanel label="Scene A" color="#0ea5e9" />;65 const toContent = to ?? <DefaultPanel label="Scene B" color="#9333ea" />;6667 const containerStyle: CSSProperties = {68 background,69 height,70 overflow: "hidden",71 position: "relative",72 width,73 };7475 return (76 <Timegroup77 className={className}78 duration={`${durationMs}ms`}79 mode="fixed"80 style={containerStyle}81 >82 <>83 <style>{`84 @keyframes framecn-frosted-glass {85 from { transform: translateX(-110%); }86 to { transform: translateX(110%); }87 }88 @keyframes framecn-frosted-show {89 from { opacity: 0; }90 to { opacity: 1; }91 }92 `}</style>93 <div style={{ inset: 0, position: "absolute" }}>{fromContent}</div>94 <div95 style={{96 animation: `framecn-frosted-show 1ms linear ${startMs + durationMsCalc / 2}ms forwards`,97 inset: 0,98 position: "absolute",99 }}100 >101// … truncated
What it pulls in
npm packages
Files it writes
More from framecn
All 101 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| AI Generate Overlayai-generate-overlay | framecn | Components | Free | 1 dep | |
| AI Generation Canvasai-generation-canvas | framecn | Components | Free | 1 dep | |
| Animated Bar Chartanimated-bar-chart | framecn | Components | Free | 1 dep | |
| Animated Line Chartanimated-line-chart | framecn | Components | Free | 1 dep | |
| Backdropbackdrop | framecn | Components | Free | 1 dep | |
| Blur Out Upblur-out-up | framecn | Components | Free | 1 dep | |
| Blur Revealblur-reveal | framecn | Components | Free | 1 dep | |
| Bounding Box Selectorbounding-box-selector | framecn | Components | Free | 1 dep |
