Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CCRotateTo and CCRotateBy differnce

//CCRotateBy
id action=[CCRotateBy actionWithDuration:1.0 angle:45];
[player runAction:action];

//CCRotateTo
id action=[CCRotateTo actionWithDuration:1.0 angle:45];
[player runAction:action];

the above two code produce same results...I need to know the difference between using rotateTo and rotateBy... please advise...

like image 664
devaditya Avatar asked Dec 04 '22 23:12

devaditya


1 Answers

CCRotateTo rotates the object to the specified angle, while CCRotateBy rotates the object to its current angle + the specified angle. They would be equivalent if your object's initial rotation is 0. However, if its initial angle was 90, CCRotateTo would rotate it towards angle 45, while CCRotateBy would rotate it towards angle 135.

like image 163
lins314159 Avatar answered Dec 23 '22 16:12

lins314159