Skip to content

Instantly share code, notes, and snippets.

W = 500
H = 585
W1 = W - 1
H1 = H - 1
def setup
@img = load_image '../scratch/girl.png'
@img.filter BLUR, 3
@img.load_pixels
end
@yone80
yone80 / roll.js
Last active August 21, 2018 10:21
Roll - Aftereffects Expression
numsegments = Math.max(2, Math.floor(effect("Segments")("Slider")));
totallength = Math.max(0.001, effect("Line Length")("Slider"));
seglength = totallength / numsegments;
sepdist = Math.max(0.001, effect("Seperation Distance")("Slider") * 0.5) / (Math.PI * 2);
roll = clamp(effect("Roll")("Slider"), 0, 1);
pos = [0, 0];
cv = [];
firsttheta = Math.sqrt(numsegments * seglength / sepdist);