ReferenceScripting APIMotionMaths
MotionMaths
interfaceMaths for code, as the logic graph's nodes have it (scene.maths, or import { maths } from "motion").
| Name | MotionMaths |
|---|---|
| Kind | interface |
| Script reaches it as | maths, or import { maths } from "motion" · MotionScene.maths · motion.maths |
| Since | 0.4 |
Syntax
interface MotionMaths { … }declare const maths: MotionMaths;Methods
| Signature | Description |
|---|---|
noise(x: number, seed?: number): numbermethod | Perlin noise along a line: smooth, -1 to 1, the same for the same x and seed. |
noise2(x: number, y: number, seed?: number): numbermethod | Smooth noise over a plane, 0 to 1. |
smoothstep(e0: number, e1: number, x: number): numbermethod | 0 below e0, 1 above e1, smooth between. |
remap(v: number, a0: number, a1: number, b0: number, b1: number, clamp?: boolean): numbermethod | A value from one range to another. |
lerp(a: number, b: number, t: number): numbermethod | Between a and b, t of the way. |
clamp(v: number, lo: number, hi: number): numbermethod | A value kept within lo and hi. |
ease(name: Easing & string, t: number): numbermethod | How far along an easing is: as scene.animate eases. |
wrap(v: number, lo: number, hi: number): numbermethod | A value wrapped round to stay within lo and hi. |
pingPong(t: number, length: number): numbermethod | T going up to length and back down, again and again. |
damp(current: number, target: number, smoothing: number, dt: number): numbermethod | A value followed toward a target, the same whatever the frame rate. |
degrees(radians: number): numbermethod | Radians as degrees. |
radians(degrees: number): numbermethod | Degrees as radians. |
Notes from the community
Written by creators and checked by the docs' editors. Not part of Motion's official reference.