How do I create an animation along predefined coordinates? Is it really that hard in Corona?

Hi,
Is there a way to move an object along predefined coordinates?
Using a table or something for the coordinates?
The way I think I would do it now is use the onComplete parameter and call the next transition.to.
But this seems overly complex and I am not sure it will create a fluid animation.

Maybe I am just getting spoiled by Corona assuming that everything in Corona should be easier than in Obj-C/Cocoa/iOS

Thanks. [import]uid: 100901 topic_id: 20092 reply_id: 320092[/import]

may be this will help

http://developer.anscamobile.com/code/move-object-through-path [import]uid: 71210 topic_id: 20092 reply_id: 78510[/import]

I was hoping there was an option without needing a loop.
Is there something that works like this in corona?

  • (void)translationMethodSchuur:(UIView*)theView{
    CAKeyframeAnimation *translate = [CAKeyframeAnimation animationWithKeyPath:@“position.x”];
    NSMutableArray *keyValues = [NSMutableArray array];
    [keyValues addObject:[NSNumber numberWithFloat:746]];
    [keyValues addObject:[NSNumber numberWithFloat:842]];
    [keyValues addObject:[NSNumber numberWithFloat:842]];
    [keyValues addObject:[NSNumber numberWithFloat:746]];

[translate setValues:keyValues];
[translate setDuration:2.5];
[[theView layer] addAnimation:translate forKey:@“spinAnimation”];
}
[import]uid: 100901 topic_id: 20092 reply_id: 78538[/import]

Ok,
so I tried the object move along path page, but that is not useful unless you like entering a gazillion coordinates by hand.

Is there no simple way to have an object move through a bunch of predefined coordinates?
The on completion method does not work because the animation will be straight lines so no curves possible.

If there is no easy way can someone point me in the direction of the “hard” way?
[import]uid: 100901 topic_id: 20092 reply_id: 84636[/import]

Not sure if I follow:
>> unless you like entering a gazillion coordinates by hand.<<
>>Is there no simple way to have an object move through a bunch of predefined coordinates?<<

How do you create a set of predefined co-ords without that typing?
One answer is to use a mathematical formula to derive the next place (like ballistics or vector calculations)

Another is to knock up a screen whose job it is to do nothing more than register touch events and print them.
(Best done in the simulator where you have pixel level control with the mouse, rather than big lumpy finger control.
So the terminal fills up with
100,110
104,140
104, 160

and so on.
Copy the lot, then add these x,y pairs to a table in code.
I’d have a module set aside for just this.
define an array at the beginning, add the points to the array.

You can then move from point to point when the screen refreshes, on a time based system, or whatever you like, simply by getting the next point in the list and moving to it.
[import]uid: 108660 topic_id: 20092 reply_id: 84638[/import]

Well I come from iOS. ANd in iOS it is really easy. iOS supports keyframe animation.
The tweening between points is done for you.
You can set the coordinates example has y only. You can set the time between keyframes and the duration of the total animation.
example:
CAKeyframeAnimation *mover = [CAKeyframeAnimation animationWithKeyPath:@“position.y”];
NSMutableArray *keyValues = [NSMutableArray array];
[keyValues addObject:[NSNumber numberWithFloat:178]];
[keyValues addObject:[NSNumber numberWithFloat:342]];
[keyValues addObject:[NSNumber numberWithFloat:338]];
[keyValues addObject:[NSNumber numberWithFloat:342]];
[keyValues addObject:[NSNumber numberWithFloat:342]];

–this whole bit is extra and handles the timing of the animation
mover.keyTimes = [NSArray arrayWithObjects:
[NSNumber numberWithFloat:0],
[NSNumber numberWithFloat:0.2],
[NSNumber numberWithFloat:0.3],
[NSNumber numberWithFloat:0.4],
[NSNumber numberWithFloat:0.5], nil];
mover.beginTime = CACurrentMediaTime()+0.1;
–ends here

[mover setValues:keyValues];
[mover setDuration:2.5];
[[theView01 layer] addAnimation:mover forKey:@“spinAnimation”]; [import]uid: 100901 topic_id: 20092 reply_id: 84642[/import]

This is an app I made:
http://www.youtube.com/watch?v=lLnSeFbSwgk&feature=player_detailpage#t=40s
at the 40 second mark you see an animation done with keyframes in objective c.
I didn’t use things like sprite sheets cause that would use too much memory. I just rotated images around certain anchor points. If you watch the whole video you can see som emore examples.
Earlier in the video I animated a crab walking, by rotating his legs and pincers with keyframe animation in Objective C. Again I did not want to use sprite sheets all the images you see are touchable and it would kill the memory. I was wondering why everyone was using sprite sheets in Corona, but I am starting to see why.

http://www.youtube.com/watch?v=lLnSeFbSwgk&feature=player_detailpage#t=63s
shark animation: the fishbone is a type of animation I have no clue on how to do that in Corona. [import]uid: 100901 topic_id: 20092 reply_id: 84643[/import]