Rotate on y axis?

hey, im having trouble trying to spin a sprite on its Y axis.

I looked in the examples, and copied the code EXACTLY…
is there any way it might not work, or anything extra that i may need to do?

var actionBy = cc.RotateBy.create(0.1, 0, -90); var delay = cc.DelayTime.create(0.25); //this.runAction(cc.Sequence.create(actionBy, delay.clone(), actionBy.reverse())); //this._sprite.runAction(cc.Sequence.create(actionBy, delay.clone(), actionBy.reverse())); this._sprite.runAction(cc.Sequence.create(actionBy, delay.clone(), actionBy.reverse()));

Above does not work!

This below works and spins on the X axis…

var actionBy = cc.RotateBy.create(0.1, 90, 0); var delay = cc.DelayTime.create(0.25); //this.runAction(cc.Sequence.create(actionBy, delay.clone(), actionBy.reverse())); //this._sprite.runAction(cc.Sequence.create(actionBy, delay.clone(), actionBy.reverse())); this._sprite.runAction(cc.Sequence.create(actionBy, delay.clone(), actionBy.reverse()));

Any thoughts?

Hi, @Elgan

It’s strange that doesn’t work, because in the samples, it does work with the same code.
Can you show us more code or screen shot. You can also print in console to see if the right value has been set in cc.RotateBy:

var actionBy = cc.RotateBy.create(0.1, 0, -90);
console.log(actionBy._angleX + ", " + actionBy._angleY);

Huabin

I’ve just tested it and it works on WebGL mode, but not on canvas mode. I’ve created an issue here: http://www.cocos2d-x.org/issues/4055

Confirmed, thats the problem :\

In fact, in Canvas mode, this is not supported, you can see it in the test case

I see… So it’s a know issue. Do you think we can “fake it” somehow to make it work on canvas?

We can of course do a pixel level mapping, but we don’t want to do this in our engine… The benefit and the cost just don’t match

What about adding a console warning so no one else falls in this problem in the future then?

this really sucks,

Tho guess i will use webGl but for now webGL has a couple of bugs that stop me using it.

What about FlipX?

Just dont think its possible via sprite sheets to fake it too :…for my case

The only way you could “fake it” I can think of (for now) is to animate ScaleX from 1 to 0, then flip the image and scale it back from 0 to 1, it won’t look as good as RotateY, but I guess it’s better than nothing?