Animate in threejs

I make a animation in three scene,and find a problem

animate({target:[cube0,cube1],props:{'position.x':-50},time:5,loop:true,sequence:.5,rewind:false,from: true})

in this line code ,that can't run
if don't use from=true,that no problem

Yes - there is a bug. Will look at it now.

Oh - there was a note in the docs:

note that from is not supported with dot properties such as "rotation.x" with threejs (a difficult bug)

But will see if we can figure out how to make it work...

Okay - I think we fixed it - just going to work on the set parameter which has the same problem. But having a bit of breakfast first... should be ready and patched within an hour - will let you know.

This has been fixed and patched in ZIM 018 - do a refresh. Thanks.

https://zimjs.com/test9/three.html

in my demo,
I use
import * as THREE from "three";
import ZIM from "https://zimjs.org/cdn/018/zim";
the problem not be fixed

probably a cache issue. Clear your cache or go to https://zimjs.org/cdn/018/zim.js and refresh. My example imports ZIM_three but that just imports the normal ZIM one like yours - and it works. If it still does not work after clearing cache then we will see if there is a further reason.


I put your example code in codePen,that not run also

It runs for me. It just animated right here on the forum and when I went to codepen. Did you clear your cache?


yes,your code example work now,
but if I animate two obj in a sequence ,it can't run also

target: [cube0, cube1],

We will have a look now.

In the Docs, there is this note under series:

Note: series with dot properties (like rotation.x for threejs) could have problems with from and set

ok

Okay - we have fixed that, I think! Do a hard refresh again and try our example here:

https://zimjs.com/test9/three.html

We had a added a test in ZIM TEN that returned out of animate if there was no target. With no ZIM objects... there was no target... so we now make a blank object for target and it seems to work.

ALSO - note the format of the series - it is not just adding the objects to an array for props you need to add an array of animation objects to props for a series.

animate({props:[
	{
		target:mesh, 
		props:{"rotation.x":360*RAD},
		from:true
	},
	{
		target:mesh2, 
		props:{"rotation.x":360*RAD},
		from:true
	}
]});
1 Like