Skip to content

MotionScript

module MotionScript
AssemblyPartas.Nacara.Plugins.Motion

Hovers compiled to a script that plays them with anime.js.

Functions and values

anime () : string

The anime.js 4.5.0 module embedded in the package.

entry (source: AnimeSource) (policy: ReducedMotion) (hovers: Hover list) : string

The script that plays the hovers.

A bundled source starts with anime.js's licence notice, as a /*! ... */ comment, then a static import of ./anime.esm.js that names only what the hovers use, for the site's bundler to resolve. A CDN source holds no static import: it loads the module with import() inside an async function, so it runs as a classic script.

A token value is read with getComputedStyle each time a hover starts, never written as var(); where the site does not define the token, its fallback is used.

Parameter
sourceWhere anime.js comes from.
policyWhat the script does for visitors who ask for reduced motion.
hoversThe hovers to play.