Let the image object move according the slot we have generated is a common feature in the game.But we should get this feature in the non-game app.So how to do it? php
So follow me... app
- Generate the path you want like this: ui
CGMutablePathRef path = CGPathCreateMutable();-Then move to the start point you want:
CGPathMoveToPoint(path, NULL, startPoint.x, startPoint.y);the startPoint is your first point.
- Add all the point data to path this
CGPathAddLineToPoint(path, NULL, tempPoint.x, tempPoint.y);- Make object moving
[self.layer addAnimation:[self animation: path] forKey:@"position"]; self.layer.needsDisplayOnBoundsChange = YES; [UIView setAnimationCurve:UIViewAnimationCurveLinear];path is the path you have made.
More information you can look this demo: code
http://www.cocoachina.com/bbs/read.php?tid=11425&keyword=%C2%B7%BE%B6%7C%B6%AF%BB%AD%3C/p%3E orm
But you should modify the code to meet your requirement. rem
Thanks, get
Blues animation