tween.js

Using three.js and tween.js to rotate object in 90 degree increments to create a 360 loop

这一生的挚爱 提交于 2019-12-07 16:35:58
问题 I have a working animation, just not the way I would like. I would like the object to rotate 90 degrees with a delay (works) then continue to rotate 90 degrees, ultimately looping forever. No matter what I do, it always resets. Even if I set up 4 tweens taking me to 360, the last tween that resets back zero makes the whole object spin in the opposite direction. Thanks var width = 1000; var height = 600; var scene = new THREE.Scene(); var group = new THREE.Object3D(); //create an empty

Three.js tween camera.lookat

夙愿已清 提交于 2019-12-07 03:09:34
问题 I'm attempting to tween the camera.lookAt in Three.js using Tween.js with little success. This works selectedHotspot = object; var tween = new TWEEN.Tween(camera.lookAt( object.position),600).start(); But rotates the camera directly to the object.position. How do I get a nice smooth rotation? This is the render function function update() { lat = Math.max(-85, Math.min(85, lat)); phi = THREE.Math.degToRad(90 - lat); theta = THREE.Math.degToRad(lon); target.x = 512 * Math.sin(phi) * Math.cos

Using three.js and tween.js to rotate object in 90 degree increments to create a 360 loop

纵然是瞬间 提交于 2019-12-06 03:22:42
I have a working animation, just not the way I would like. I would like the object to rotate 90 degrees with a delay (works) then continue to rotate 90 degrees, ultimately looping forever. No matter what I do, it always resets. Even if I set up 4 tweens taking me to 360, the last tween that resets back zero makes the whole object spin in the opposite direction. Thanks var width = 1000; var height = 600; var scene = new THREE.Scene(); var group = new THREE.Object3D(); //create an empty container var camera = new THREE.OrthographicCamera(width / -2, width / 2, height / 2, height / -2, -500, 1000

Jerky animated movements in three.js Animation

荒凉一梦 提交于 2019-12-04 18:43:59
Hi i have problem with animation and movement in my three.js scene. When I move my camera (even by 0,0000001%)(by THREE.TrackballControls OR THREE.OrbitControls) or when I animate object using Tween.js, my animation is very jerky, object is jumping durning animatinon around the axis of movement, look like it is error with rounding in position. Problem is bigger, when i move far from scene center (senter is on vertex (0,0,0)) for example I'm on vertex (0,8000000,0) and problem is bigger. It is doing when I move camera or move object. Im using standard example codes and satndard libraries:

Tween camera position while rotation with slerp — THREE.js

大城市里の小女人 提交于 2019-12-04 10:55:07
问题 I want to tween camera position while rotation. Here is my function: function moveAndLookAt(camera, dstpos, dstlookat, options) { options || (options = {duration: 300}); var origpos = new THREE.Vector3().copy(camera.position); // original position var origrot = new THREE.Euler().copy(camera.rotation); // original rotation camera.position.set(dstpos.x, dstpos.y, dstpos.z); camera.lookAt(dstlookat); var dstrot = new THREE.Euler().copy(camera.rotation) // reset original position and rotation

Morph a cube to coil in three js

白昼怎懂夜的黑 提交于 2019-11-29 08:13:36
I have tried to morph a thin rectangular cube to coil by three.js and tween.js . I've searched questions that already has been ask but none of them guide me. Which morph function should I use, and how can I create a coil shape? have your tube stored as a set of N slices You need center point and normal vector for each (circle) slice. const int N=128; struct slice { float p[3],n[3]; }; slice mesh[N]; Init it to tube at start (aligned to y axis) for (int i=0;i<N;i++) { mesh[i].p[0]= 0.0; mesh[i].p[1]=-1.0+2.0*float(i)/float(N-1); mesh[i].p[2]= 0.0; mesh[i].n[0]= 0.0; mesh[i].n[1]=+1.0; mesh[i].n

Morph a cube to coil in three js

给你一囗甜甜゛ 提交于 2019-11-28 01:39:53
问题 I have tried to morph a thin rectangular cube to coil by three.js and tween.js . I've searched questions that already has been ask but none of them guide me. Which morph function should I use, and how can I create a coil shape? 回答1: have your tube stored as a set of N slices You need center point and normal vector for each (circle) slice. const int N=128; struct slice { float p[3],n[3]; }; slice mesh[N]; Init it to tube at start (aligned to y axis) for (int i=0;i<N;i++) { mesh[i].p[0]= 0.0;