0

I have a tweening function to animate the camera angle using "Easing.Elastic.Out". How do I change the Period and Amplitude of the easing?

camera.lookAt(scene);
var controls = new THREE.OrbitControls(camera, renderer.domElement);

function camTweenLeft (startAngle){
   var prevAngle=startAngle;
   var tween = new TWEEN.Tween({angle:startAngle})
   .to({angle:startAngle - 40*Math.PI/180},1000)
  .easing(TWEEN.Easing.Elastic.Out)
  .onUpdate(function(){
   controls.rotateLeft(this.angle-prevAngle);
   prevAngle=this.angle;
  })
  .start()
  }
juxpin
  • 3
  • 3

2 Answers2

0

Check the TWEEN JS documentation as its a library used by Three.js but not part of it.

https://github.com/tweenjs/tween.js/blob/master/docs/user_guide.md

The graphs example shows what easing functions you can have at https://github.com/tweenjs/tween.js/blob/master/examples/03_graphs.html

You can also create your own custom easing function.

Komsomol
  • 698
  • 10
  • 27
0

Don't think TweenJS exposes period and amplitude to be changed for an Elastic ease but GSAP does ;) i.e. only if you are interested in giving it a try.

Tahir Ahmed
  • 5,687
  • 2
  • 17
  • 28