Linear interpolate/lerp through multiple vector3

currently i use an array of vector3 to make a curve with zero tension and use getPoint() in the range of 0-1 to traverse/animate a camera or object across a path made with the vectors.

is there a better way to do this ?

You could use an external animation library like GSAP or Tween.js.

For simple linear interpolations, the built-in animation system can also be used. However, you have to setup the keyframes manually which requires a bit low-level programming.

https://jsfiddle.net/c8Lk621r/

2 Likes

i’m already using tween js :+1:

my goals are

  • use a slider to scrub an object across the lines created from vectors.
  • use tweenjs to control the same slider to animate along the path with easing.

not looking into keyframes as i’m mostly going to animate the camera and the orbitcontrols target

i’ll try with tweenjs timeline

with each tween doing

timeline{
   //  1 )A to B lerp 
   // 2) B to C .lerp
}

edit: tween js does not have timeline but ‘chain’