Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development > iPhone SDK Development - Advanced Discussion

Reply
 
LinkBack Thread Tools Display Modes
Old 08-17-2010, 06:14 AM   #1 (permalink)
Registered Member
 
screwtape's Avatar
 
Join Date: Jul 2010
Location: Nottingham
Posts: 54
screwtape is on a distinguished road
Send a message via Skype™ to screwtape
Default Subclassing CAKeyframeAnimation

Hi All,

I'm looking at subclassing CAKeyframeAnimation in order to sync an animation with the associated sound effects. I can't see any methods in the documentation which do anything but I presume that the CALayer must call some methods in the CAAnimation to do the work, but it doesn't seem to be documented.

Anyone any ideas how to do this?

Screwtape.
screwtape is offline   Reply With Quote
Old 11-21-2011, 11:40 PM   #2 (permalink)
Registered Member
 
Join Date: Nov 2011
Posts: 1
prisoner24601 is on a distinguished road
Default

Quote:
Originally Posted by screwtape View Post
Hi All,

I'm looking at subclassing CAKeyframeAnimation in order to sync an animation with the associated sound effects. I can't see any methods in the documentation which do anything but I presume that the CALayer must call some methods in the CAAnimation to do the work, but it doesn't seem to be documented.

Anyone any ideas how to do this?

Screwtape.
If you just need to sync an animation with the associated sound effects you don't need to subclass.

You can just use
Code:
- (void)animationDidStart:(CAAnimation *)anim;
from the CAAnimation Class

here is the sample from one of my view controllers

Code:
- (void)startAnimation{
	
    NSArray*     prisonImages2 = [[NSArray alloc] initWithObjects:
                                 (id)[Utils loadImage:@"ZAM_01.png"].CGImage,
                                 (id)[Utils loadImage:@"ZAM_02.png"].CGImage,
                                 (id)[Utils loadImage:@"ZAM_03.png"].CGImage,
                                 (id)[Utils loadImage:@"ZAM_04.png"].CGImage,       
                                 nil];
    
	CAKeyframeAnimation *animation = [CAKeyframeAnimation animation];
	animation. values = prisonImages2;
        [prisonImages2 release];
	animation. duration = 2;
	animation. autoreverses = NO;
	animation.delegate = self;
	animation.calculationMode = kCAAnimationDiscrete;
        [prisonImageView.layer addAnimation: animation forKey: @"contents" ] ;
      
	
}

- (void)animationDidStart:(CAAnimation *)anim{
   //play your sound, it will start when the animation begins its active duration
}
prisoner24601 is offline   Reply With Quote
Reply

Bookmarks

Tags
cakeyframeanimation, subclass

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 382
15 members and 367 guests
AragornSG, ChrisYates, coolman, davejas69, givensur, hussain1982, iAppDeveloper, jbro, Kryckter, locombiano89, Mah6447, Meoz, stanny, Tomsky, WeaselPig
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,646
Threads: 94,111
Posts: 402,862
Top Poster: BrianSlick (7,990)
Welcome to our newest member, locombiano89
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:45 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0