{{ store.width }} x {{ store.height }}
upload Upload
upload Full crop Thumbnail
arrow_selector_tool Start Photographer arrow_selector_tool Slow 1s/page: {{ store.photographerSlow ? 'On' : 'Off' }}
{{ store.uploading ? 'Uploading...' : (store.complete ? 'Done' : '') }} {{ store.photographerRunning ? 'Photographer running...' : '' }}
upload Digitize

{{ store.filename || 'Drop an image onto the page.' }}

Drag the frame to move, corners to resize, top handle to rotate.

upload Choose image
Digitize reference

Apple Motion Timing Curve

{{ item.title }}

{{ definition.value }}
Implements Apple-style kinematic timing curves with smooth overshoot and oscillation effects.
{{ store.loading ? 'Thinking...' : store.response }}

files: head point stage mouse dragging stroke ../point_src/random.js


The stepMotion function:

(t)=>stepMotion(t, .01, 0.5, .6, 8)
  • t: time delta: 0-1
  • anticipation: .1
  • midpoint: .5
  • oscilation: .1
  • damping: .001

An implementation of https://jcgt.org/published/0011/03/02/paper.pdf

// KinematicTimingCurve.c

// Smooth timing curve value
float Xs(float t, float ta, float tmid) {
    float tam = ta - tmid - tmid; // ta - 2tmid

    float xa = (2.0*t*(ta - t) / (ta*tmid + tam));
    float xd = ((t - 2.0)*t*tam + (ta - 2.0)*tmid*tmid);
    xd /= ((tmid-1.0)*(ta*tmid + tam));

    return t<tmid ? xa : xd;
}

// Overshoot timing curve value
float Xo(float t, float ta, float tmid, float B) {
// terms independent of t: can be precomputed
    float tma = tmid - ta;
    float td = 1.0 - tmid;
    float amp = td*(tmid + tma)/(tmid*tma*B*M_PI);

// time-dependent terms
    float xa = t*(t - ta) / (tmid*tma);

// really only needed if t>tmid
    float xd = amp * sin(B*M_PI*(t - tmid)/td);
    xd *= exp(-(t - tmid)*(B/(4.0*td)));
    xd += 1.0;
    return t<tmid ? xa : xd;
}

// Timing curve with anticipation ta, midpoint tmid, and bounces B
float KinematicTiming(float t, float ta, float tmid, int B) {
    return B>=1 ? Xo(t,ta,tmid,float(B)) : Xs(t,ta,tmid);
}
Meta Data
title Apple Motion Timing Curve
imports ()
files ()
unused_keys ()
unknown_keys ()
filepath_exists True
path apple-motion-algo
filepath apple-motion-algo.js
clean_files ()
Logger Install Logger {{ store.words }}
{{ store.errorText.message }}
{{ store.errorText.stackText }}