I'd like to use Core Animation to create an arbitrary animation, that
is, I have a number of custom-drawn frames that I want to render in a
sequence, with a good frame rate, using the Core Animation timing
engine. How do I do this?

I am looking on CAKeyframeAnimation, which could do the job using the
code like this:

    CAKeyframeAnimation *anim;
      NSMutableArray *images;
      CGImageRef im;
      int i;

      images = [NSMutableArray array];
      for (i = 0; i < N; i++) {
     im = create_image (i);
     [images addObject:(id)im];
     CGImageRelease (im);
      }

      anim = [CAKeyframeAnimation animation];
      [anim setKeyPath:@"contents"];
      [anim setValues:images];
      [anim setCalculationMode:@"discrete"];
      [anim setRepeatCount:HUGE_VAL];
      [anim setDuration:1.0];

      [layer addAnimation:anim];

However, I don't like to create all keyframe images at once, but
instead draw them in process of animation, when the particular frame
becomes the current frame, via the -[CALayer drawLayer:inContext:]
delegate method. How do I do this? The delegate method seems to get
called only once. Thanks!
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to