I don’t fully understand but I made a program which transitions between two vectors (one is random, the other isn’t)
PVector v1 = new PVector(0,250); //0 = dir, 100 = power
PVector v2 = new PVector(random(TWO_PI),random(50,300));
float age = 0, maxAge = 100, cx = 300, cy = 300;
void setup() {
size(600,600);
}
void draw() {
background(0);
if(mousePressed) age+=0.5;
if(age > maxAge) {
age = 0;
v2 = new PVector(random(TWO_PI),random(50,300));
}
PVector displayV = transition(v1,v2,age,maxAge);
stroke(255);
line(cx,cy, cx + cos(displayV.x)*displayV.y, cy + sin(displayV.x)*displayV.y);
stroke(255,0,0);
line(cx,cy, cx + cos(v1.x)*v1.y, cy + sin(v1.x)*v1.y);
stroke(0,0,255);
line(cx,cy, cx + cos(v2.x)*v2.y, cy + sin(v2.x)*v2.y);
}
PVector transition(PVector start, PVector end, float step, float steps) {
return( new PVector( map(step,0,steps,start.x,end.x), map(step, 0, steps, start.y, end.y) ));
}