CAMediaTimingFunction with 3 {0.0f} Control Points?
I'm trying to animate the alpha transitions of some NSVie开发者_运维技巧ws. It needs to happen during another animation, specifically of it's superview (a bounds change). It's kind of complicated to explain why, but I need these alpha transitions to have a timing function wherein the alpha stays at 0.0 for the first 3/4 of the duration (0.25 seconds). I thought that if I defined my own timing function with the control points 0.0, 0.0, 0.0, 1.0, it would achieve the desired effect. Obviously, I don't understand timing functions specifically and math in general.
If anyone could provide some advice, that would be great!
Regards, Alec
The CAMediaTimingFunction creates a bezier curve using the control points. I think for this task a better solution would be to use keyframes for the opacity animation.
CAKeyframeAnimation *animation = [CAKeyframeAnimation animation];
animation.values = [NSArray arrayWithObjects:
[NSNumber numberWithFloat:0.0],
[NSNumber numberWithFloat:1.0], nil];
animation.keyTimes = [NSArray arrayWithObjects:
[NSNumber numberWithFloat:0.75],
[NSNumber numberWithFloat:1.0], nil];
Which will create an animation that stays at 0 until three quarters of the duration and then moves to 1.
精彩评论