Scripts2026年7月23日·1 分钟阅读

mo.js — Motion Graphics Toolbelt for the Web

A JavaScript motion graphics library for creating expressive UI animations with shapes, bursts, timelines, and tweens.

Agent 就绪

Agent 可直接安装

这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
mo.js Overview
直接安装命令
npx -y tokrepo@latest install 945fc35c-862d-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run 确认安装计划,再运行此命令。

Introduction

mo.js is a motion graphics library built for the web. Unlike traditional animation libraries that tween CSS properties, mo.js provides declarative primitives for shapes, bursts, stagger effects, and custom path animations. It was designed for crafting rich, interactive motion experiences.

What mo.js Does

  • Creates shape animations (circles, rects, polygons, lines, crosses) with property tweens
  • Generates particle burst effects with configurable count, radius, and child shapes
  • Provides a timeline system for sequencing and orchestrating multiple animations
  • Supports custom easing curves and path-based motion along SVG paths
  • Delivers stagger effects for animating groups of elements with offset timing

Architecture Overview

mo.js uses a module-based architecture where each animation primitive (Shape, Burst, Tween, Timeline) is an independent unit. Shapes render to SVG elements and expose property deltas (from/to values). The internal clock runs on requestAnimationFrame, and modules can be composed into Timelines for orchestration. Burst decomposes into child Shape instances arranged radially.

Self-Hosting & Configuration

  • Install via npm or load the UMD bundle from a CDN
  • Import @mojs/core for the main library
  • Use the mo.js editor (separate package) for visual curve editing
  • Set isShowEnd: false to hide shapes after animation completes
  • Chain .then({...}) on any module to create multi-step sequences

Key Features

  • Declarative delta syntax: { 0: 100 } means animate from 0 to 100
  • Built-in Shape primitives render directly to SVG without external assets
  • Burst module creates particle-like effects with minimal code
  • Path easing lets you define motion curves as SVG path strings
  • Retina-ready rendering with crisp SVG output on all screen densities

Comparison with Similar Tools

  • anime.js — general-purpose CSS/SVG tween library; mo.js focuses on shape and burst primitives
  • GSAP — comprehensive timeline engine with broader scope; mo.js is more opinionated toward motion graphics
  • Framer Motion — React-specific with layout animations; mo.js is framework-agnostic
  • Lottie — plays After Effects exports; mo.js creates animations programmatically

FAQ

Q: Can I use mo.js with React? A: Yes. Create animation instances in useEffect and call .play(). Clean up is not required as mo.js manages its own lifecycle.

Q: Is mo.js actively maintained? A: The library is stable. The community maintains it under the @mojs organization with periodic updates.

Q: How do I chain animations? A: Use .then({...}) to append a new state, or compose multiple modules into a mojs.Timeline.

Q: Does mo.js support scroll-triggered animations? A: Not natively. Use an Intersection Observer or a scroll library to call .play() when elements enter the viewport.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产