{{ store.errorText.stackText }}
Brownian Within a Point
files: head point stage mouse dragging stroke ../point_src/random.js
The stepMotion function:
js
(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 | Brownian Within a Point |
| imports | () |
| files | () |
| unused_keys | () |
| unknown_keys | ('categories',) |
| categories | ['brownian', 'random'] |
| filepath_exists | True |
| path | apple-motion-algo |
| filepath | apple-motion-algo.js |
| clean_files | () |
Logger
Install Logger {{ store.words }}