Re: Original iPhone animation performance
Re: Original iPhone animation performance
- Subject: Re: Original iPhone animation performance
- From: Andrew <email@hidden>
- Date: Thu, 20 May 2010 10:51:26 +1200
Hi Ricky,
that is interesting, for some reason I assumed that the presentation layer would take care of caching the presented view.
ok, I will try that and see how it goes, thanks.
is there anything else you can think of that might make a difference?
- Andrew Bush
>
>> Im writing some code to animate an image moving up the display, just a simple thing moving from the bottom to the top.
>>
>> the image is 75x75, and Im displaying that in a CALayer sized to 45x45 by setting its .contents property to the .CGImage of the UIImage.
>
> This could be the issue. On iPhone OS, try your best not to scale any images repeatedly. Thus, you should create an alternate version of your image at 45 x 45 and then animate that.
>
>> on the newer phones this runs very smoothly, even if I have more than one of those CALayers animating at once, but on an older (original) iPhone I am testing on the animation is slightly rough/jerky even with only a single image moving.
>>
>>
>> The iPhone is running 3.1.3 and I am performing the animation using this code:
>>
>> CABasicAnimation* animation = [CABasicAnimation animation];
>> animation.keyPath = @"position.y";
>>
>> CGFloat from=self.position.y;
>> CGFloat to=self.position.y-[self.calculator distanceForAnimationStartingAt:from];
>>
>> animation.fromValue = [NSNumber numberWithFloat:from];
>> animation.toValue = [NSNumber numberWithFloat:to];
>>
>> CGFloat distance=to-from;
>>
>> animation.duration = [self.calculator timeToTravelDistance:distance];
>> animation.repeatCount = 1;
>> animation.autoreverses = NO;
>> animation.timingFunction = [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionEaseInEaseOut];
>> animation.removedOnCompletion = NO;
>> animation.fillMode = kCAFillModeForwards;
>> animation.delegate=self;
>> [self addAnimation:animation forKey:@"animateUp"];
>>
>>
>> so, obviously the older phone is basically just less capable, but is it likely to be possible to smooth things out? are there any known tricks or things I can do that might improve things on the older hardware?
>>
>>
>> Thanks for any help.
>>
>>
>> - Andrew Bush
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>>
>> 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
>
> ___________________________________________________________
> Ricky A. Sharp mailto:email@hidden
> Instant Interactive(tm) http://www.instantinteractive.com
>
>
>
_______________________________________________
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