Re: Simple Flipbook Animation?
Re: Simple Flipbook Animation?
- Subject: Re: Simple Flipbook Animation?
- From: Matt Long <email@hidden>
- Date: Sat, 1 Nov 2008 22:31:16 -0600
Jeshua,
I put together a little demo app that works in the simulator. Haven't
tried on my device yet, though. Take a look here:
http://www.cimgf.com/files/ImageFlip.zip
And one comment about the code. If you don't want a transition between
images when using a keyframe animation for the content, you can just
set the calculation mode to discrete like this:
[anim setCalculationMode:kCAAnimationDiscrete];
Then the keyframe animation won't interpolate values in between each
image. Only keyframes are shown.
-Matt
On Nov 1, 2008, at 11:26 AM, Jeshua Lacock wrote:
On Oct 31, 2008, at 12:13 PM, John Harper wrote:
I described how to do this using a CAKeyframeAnimation in a
previous thread:
http://www.cocoabuilder.com/archive/message/cocoa/2008/8/3/214715
I am trying to adapt this technique for the iPhone SDK, but
attempting to add the images NSArray to the KeyFrame animation
causes my program to crash.
I heard that last week an iPhone dev list was created at Apple, but
I have not been able to find it. I hope this is similar enough to be
on-topic here, as I am using the same classes for the most part.
I can't find any examples that specify an image or array of images
for the 'setValues' property.
NSArray *redExplode;
NSMutableArray *images;
images = [NSMutableArray array];
CGImageRef im;
UIImage *thisImg;
int p;
//frames ommitted for brevity
redExplode = [[NSArray arrayWithObjects:
[UIImage imageNamed:@"redExlode.00000.png"],
[UIImage imageNamed:@"redExlode.00001.png"],
nil] retain];
for(p = 0;p<[redExplode count];p++)
{
thisImg = [redExplode objectAtIndex: p];
im = thisImg.CGImage;
[images addObject:(id)im];
CGImageRelease (im);
}
[anim setKeyPath:@"contents"];
[anim setValues:images];
[anim setCalculationMode:@"discrete"];
[anim setRepeatCount:HUGE_VAL];
[[UIAnimator sharedAnimator] addAnimation:anim withDuration:1.5
start:YES];
A backtrace reveals:
#0 0x950886ec in objc_msgSend ()
#1 0x9539d57f in NSPopAutoreleasePool ()
#2 0x953d6974 in __NSFireDelayedPerform ()
#3 0x96c10b45 in CFRunLoopRunSpecific ()
#4 0x96c10cf8 in CFRunLoopRunInMode ()
#5 0x31699d38 in GSEventRunModal ()
#6 0x31699dfd in GSEventRun ()
#7 0x30a5dadb in -[UIApplication _run] ()
#8 0x30a68ce4 in UIApplicationMain ()
#9 0x00002d3c in main (argc=1, argv=0xbfffef68) at /Developer-3.1.0/
Examples/iPhone/MoveMe/main.m:53
The assembly that is crashing is:
0x950886ec <+0028> mov 0x0(ķi),%esi
If I comment out the line "[anim setValues:images];", the program
does not crash.
Any ideas?
Thanks,
Jeshua Lacock
Founder/Programmer
3DTOPO Incorporated
<http://3DTOPO.com>
Phone: 877.240.1364
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden