iOS how to animate an image to follow a line

mandude

macrumors member
Original poster
Nov 19, 2009
64
0
hi i have a line that is created everytime the user taps the screen going from one constant point (150, 150) to the point the user taps. I would like an image (image.png) to move from right to left along this line when the line appears, and when the picture reaches the end of the line.. disappears. heres the code of the line when the user taps :


CGContextMoveToPoint(context, 150.0, 150.0);
CGContextAddLineToPoint(context, touch.x, touch.y);
CGContextStrokePath(context);



heres the arc:
CGContextMoveToPoint(context, 220.0, 200.0);
CGContextAddQuadCurveToPoint(context, 150.0, 20.0, firstTouch.x, firstTouch.y);
CGContextStrokePath(context);
 

mandude

macrumors member
Original poster
Nov 19, 2009
64
0
thanks for the reply, but the MoveMe app doesn't see, to meet the criteria i need. I need and image to follow an arc that is prduced
 

mandude

macrumors member
Original poster
Nov 19, 2009
64
0
yes you're right i can create a path that is the same here is the code, but i now need to know how to make the image appear and start to follow the path in the "EaseIn" animation curve type.


// Making the red line appear where the arc is.
CGContextMoveToPoint(context, 220.0, 200.0);
CGContextAddQuadCurveToPoint(context, 150.0, 20.0, firstTouch.x, firstTouch.y);
CGContextStrokePath(context);
//making the same animation path as the red line will show.
CGMutablePathRef thePath = CGPathCreateMutable();
CGPathMoveToPoint(thePath, NULL, 220.0, 200.0);
CGPathAddQuadCurveToPoint(thePath, NULL, 150.0, 20.0, firstTouch.x, firstTouch.y);
 

Similar threads

Register on MacRumors! This sidebar will go away, and you'll see fewer ads.