Command Palette
Search for a command to run

Media Between Text

A component that animates a media (image or video) between two text elements.

motion-sv

Mañgo

Abstract landscape used in the Media Between Text preview

Time

Installation

pnpm dlx shadcn-svelte@latest add https://sv-animations.vercel.app/f/media-between-text.json

Logic Image

Media Between Text logic

Examples

Scroll-triggered Reveal

Open/Close Trigger

Happy

Happy Birthday

Birthday

Vertical Open/Close

Hello

Hello Svelte

Svelte

Props

PropTypeDefaultDescription
firstTextstringrequiredText rendered before the media reveal.
secondTextstringrequiredText rendered after the media reveal.
mediaUrlstringrequiredImage or video source URL.
mediaType"image" | "video"requiredControls whether an img or video element is rendered.
mediaContainerClassstring''Classes applied to the animated media wrapper.
fallbackUrlstring | undefinedundefinedPoster URL used when rendering video media.
askeyof SvelteHTMLElements"p"HTML element used for each text fragment.
autoPlaybooleantrueWhether video media should autoplay.
loopbooleantrueWhether video media should loop.
mutedbooleantrueWhether video media should be muted.
playsInlinebooleantrueWhether video media should play inline on mobile browsers.
altstring | undefinedundefinedAlt text used for image media.
triggerType"hover" | "ref" | "inView""hover"Controls when the media reveal animation runs.
containerRefHTMLElement | Document | nullnullOptional viewport root used with in-view triggering.
useInViewOptionsPropUseInViewOptions{ once: true, amount: 0.5 }Options forwarded to the in-view observer.
animationVariantsVariantsdefaultAnimationVariantsMotion variants used for the media reveal.
leftTextClassstring''Classes applied to the first text fragment.
rightTextClassstring''Classes applied to the second text fragment.
classstring''Classes merged onto the root container.