code for setAnimation

28 views
Skip to first unread message

Jowito 2000

unread,
Oct 4, 2017, 1:26:35 PM10/4/17
to CoSpaces

Hi. I was just doing my world in javascript code and i wanted to make it animated so i thought of putting an animation to the object, and then changing. For example to start talking but then start to walk. but i realice that there is no code to set an animation? pls if there is any code to set an animation in javascript it would be just the only thing i need, because would make the world very animated. I know there is a block in blockly to set an animation but i don't want to use blockly in my world because i want it to be only script. Thx for the help

Benjamin Singh

unread,
Oct 5, 2017, 5:13:03 AM10/5/17
to CoSpaces
We have an internal method to play a looped animation. It's the same used in Blockly. But the method can change in the future because it isn't public yet. Please keep that in mind.

obj.playIdleAnimation('animationName');

You can get the names for the animations from the object menu.


Example script:


var unicorn = Scene.getItem('unicorn');
unicorn
.playIdleAnimation('Walk');


Benjamin


Jowito 2000

unread,
Oct 5, 2017, 12:20:30 PM10/5/17
to CoSpaces
Ohh. Really thank you so much for helping us. You just helped us a lot. You are amazing.
Reply all
Reply to author
Forward
0 new messages