Hi there,
I have a custom ease function which I am using to animate particles within a 3d space. I am trying to draw a line between the start point and end point using three.js
My easing equation looks like this
let EasingEquation = CustomEase.create("custom", "M0,0 C0.33,0.024 0.396,1.258 0.658,1.15 0.777,1.1 0.804,1 1,1 ");
currently I am able to create a straight line between the points with simple linear interpolation (lerping the 3d vector values) like this:
let from = [100,100,100];
let to = [10,10,10];
let linevertices = [];
let newpos = new THREE.Vector3();
for(let j = 0; j < 10; j ++)
{
//this loop runs 10 times for 10 points along the line to build linear geometry
newpos.lerpVectors(new THREE.Vector3(from[0],from[1],from[2]),new THREE.Vector3(to[0],to[1],to[2]),(1.0/10)*j);
linevertices.push(newpos);
}
//this sucessfully outputs the linearly interpolated values
What I am trying to achieve is:
instead of simply drawing a straight line with the linear interpolation, i would like to draw the animation path which is created using the custome EasingEquation but so far all I have managed to create is NaNs and Errors.
Does anyone know how this might be achieved?
Thanks very much