Tween: rotating an object 360

Hi,

I am new to wick editor. I am trying to use a tween to rotate (clockwise) an object 360 degrees, but it is not working.

I then tried to rotate the object twice by rotating the object clockwise 180. The 180 degrees rotation works. However, when I tried to complete the full 360 degree rotation, the object rotated counter clockwise instead of rotating the object clockwise.

I would appreciate any suggestions.

Are you going the be exporting as a video/gif/image or an html/zip?
If you do interactive export, you can create an update script in the clip and put
this.rotation+=(number);

It isn’t interactive. Because it is a short clip, I will probably do a video/gif/image.

I believe code is still run when exporting gif/ mp4

I've tested it before

All parts of the code that require interaction, however, will not be run (such as mouse and key events).
Everything else, such as rotation, opacity, size, position, can be changed through code.

I believe that’s because objects in Wick can only be rotated from -180 to 180 degrees (0 being default rotation). Try, instead of having the object rotate from 0 to 360, to rather have it rotate from -180 to 180 degrees.

Thank you both for your help, I really appreciate it. Since it is not an interactive export, I did the -180 and 180, which works. I will keep your suggestion Watrmeln if I decide to an interactive export.

Non-interactive export can be created using code.

I was trying to practice my skills in JavaScript. I was trying to rotate the object 360 once using code, but it is not working.

This is what I have so far. rotate360.wick (2.8 KB)

I got it to work using a button.
rotateButton.wick (2.7 KB)

I would appreciate any suggestions.

Here an example…
rotateSquare3-12-2022_21-27-07.wick (1.6 KB)

Your main problem is that the default script runs only once…

In order to get your code updated every frame you have to add an update script:

1 Like

Hi Jovanny,

Thank you so much, I really appreciate your help.
So if I want the square to only rotate once then do I select Animation: Play Once?

I tried to add the code in the update tab:
if (this.rotation == 360) {
break;
}

However, it does not recognize break;

Try…

if(this.rotation<360) {
this.rotation+=1;
}
1 Like

I tried it but it did not work.

I tried this:
this.rotation+=10;

if (this.rotation>360) {
this.stop()
}

but that didn’t work either.

I also noticed below Animation, Synced. What does that do?

Here…
rotateSquare3-13-2022_0-04-27.wick (1.6 KB)

Screen Shot 2022-03-13 at 12.04.44 AM

Thank you so much. I really appreciate it.

Strange, when I did that, it didn’t work. Now it does.

If an object is synced, the animation inside of object will play with the project’s timeline.

Thank you

I tried to research the answer, but could not find it.

1 Like