1.0.1 • Published 4 years ago
sparkar-easing-signals v1.0.1
Spark AR - Easing Signals
Description
This is a collection of polynomial easing functions. Though similar tools already exist for animations, the EasingSignals functions can be used to derive eased values from other types of interactive input (e.g. object size bound to mouth openness, or speaker volume bound to a slider). All functions take a ScalarSignal input (0-1 expected) and return a ScalarSignal with the eased value.
For more info, see these comparisions of various easing functions, and gre's gist.
Usage
const FaceTracking = require("FaceTracking");
const Scene = require("Scene");
const EasingSignals = require("sparkar-easing-signals");
const rectangle = Scene.root.find("rectangle0");
const mouthOpenness = FaceTracking.face(0).mouth.openness;
const easedOpenness = EasingSignals.easeOutQuad(mouthOpenness);
rectangle.transform.scaleX = easedOpenness;
rectangle.transform.scaleY = easedOpenness;