Word swapWord swap
在 MOGA 中打开

组件

Word swap

@moga/kinetic-type · MOGA 官方

属于素材包 Kinetic type

A line that stays put while one word in it keeps changing: the lead and trail enter once, each new word rolls up into the slot as the old one leaves through the top, and the slot's width follows the word on a spring (on a pill, the pill stretches with it). Swaps every few seconds, or keyframe index to land each word on a beat. Place it over the whole frame.

npx motioncn-cli add moga/kinetic-type/word-swap

版本 1.0.2MIT31 次下载0 人收藏

更新于 2026年12月3日

在 MOGA 里用

只导入这一个,不用整个素材包。它用到的素材包令牌会一起导入。在项目文件夹里运行:

npx -y moga hub-import @moga/kinetic-type --items component:word-swap

在 MOGA 之外用(Motioncn)

免费,不用登录。它是普通的网页代码,在网页、React、Remotion 和 HyperFrames 里都能播放,画出的帧和 MOGA 渲染的一样。

用 shadcn 装进你的项目

npx shadcn@latest add https://motioncn.dev/r/moga/kinetic-type/word-swap.json

没配 shadcn 也能装

npx motioncn-cli add moga/kinetic-type/word-swap

不用构建,直接在网页里引用

import WordSwap from 'https://motioncn.dev/m/moga/kinetic-type/word-swap.js';
import preset from 'https://motioncn.dev/m/theme.js';
WordSwap.mount(document.querySelector('#stage'), { preset, duration: 5 }).play();

React、Remotion 和 HyperFrames

// React (https://motioncn.dev/r/player-react.json)
<Motion motion={WordSwap} preset={preset} duration={5} fit />
// Remotion (https://motioncn.dev/r/player-remotion.json)
<MotionClip motion={WordSwap} preset={preset} />
// HyperFrames (https://motioncn.dev/m/hyperframes.js)
follow(WordSwap.mount(element, { preset, duration: 5 }), { start: 0 });