I was playing with the new bezier functions and noticed a small bug in the documentation:
bezierQuadratic(t
, p0
, p1
, p2
)
Return a quadratic bezier curve at t
given the start point p0
, control point p1
and end point p2
.
(bezierQuadratic should take 5 parameters, ending with p3)
bezierCubic(t
, p0
, p1
, p2
)
Return a cubic bezier curve at t
given the start point p0
, control points p1
, p2
, and end point p3
.
(bezierQuadratic should take 4 parameters, ending with p2)
Otherwise, all good. Fast and fun! Will be super helpful for animators, and anybody else who needs to build smooth, precise curves.
v3.30 bezier test pattern - click for code
// Bezier Testbed -- Look! I can draw silly things!
// Requires Pixelblaze3 with v3.30 or higher firmware
// 11/2022 ZRanger1
export function beforeRender(delta) {
t1 = time(0.04);
c1 = wave(t1);
c4 = wave(-0.25-t1);
t2 = time(0.01)
c2 = wave(t2)
c3 = wave(-0.25-t2)
}
export function render2D(index,x,y) {
d = bezierCubic(x,c1,c2,c3,c4);
v = 1-min(1,(abs(y-d)/ 0.165));
hsv(t1+d, 1, v*v*v)
}