-
sine/cosine interpolation hand-written
Hello, I started my first trig class, and I was playing around with ideas to put a variety of points that are arranged in space and connect them with Write-on using cosine interpolation. I got the first two points to connect pretty easily:
p1 =thisComp.layer(“P1”).transform.position;
p2 = thisComp.layer(“P2”).transform.position;
t = -Math.cos(Math.PI*time)/2 + .5;
linX = p1[0] + t*(p2[0]-p1[0]);
linY = p1[1] + time*(p2[1]-p1[1]);
[linX,linY]but I want to loop p1 and p2 so when the line goes from p1 to p2, the expression will update and make p1 into p2 and p2 into p3 (the dots are named this in the comp to make things simple) I am figuring it is done with a while loop or maybe a long if/else function but I’m not altogether sure how to set it up. Thanks for any help!