This class is similar to SPTween, making it easy to move any object around a Bezier path. The adjustAngle property makes SXMotionTween to change object's rotation to the path's tangent automatically.
Public Classes
* SXMotionTween, the animation object you add to a juggler
* SXMotionTweenPath, the object containing an animation path you add to one or many SXMotionTween objects (when you reuse a SXMotionTweenPath you must retain it to prevent the juggler from releasing!)
SXMotionTweenPath *path = [SXMotionTweenPath path]; [path startPoint: [SPPoint pointWithX: 10 y: 10]]; [path addLineToPoint: [SPPoint pointWithX: 250 y: 10] duration: 1.0]; [path addLineToPoint: [SPPoint pointWithX: 250 y: 250] duration: 1.0]; [path addLineToPoint: [SPPoint pointWithX: 10 y: 250] duration: 1.0]; [path addLineToPoint: [SPPoint pointWithX: 10 y: 10] duration: 1.0]; SXMotionTween *tween = [SXMotionTween tweenWithTarget: mySprite andPath: path]; tween.delay = 1; // wait one second tween.adjustAngle = YES; // make the image rotate along the path tween.angleOffset = 3.14/2; // adjust facing position [self.stage.juggler addObject: tween];
No comments so far. Feel free to edit this part of the page.