Ale*_*x G 3 xcode animation objective-c ios
我还在学习UIAnimations,刚进入它,我偶然发现了一个我不确定如何解决的问题.我已经看到了你获得新的高分的游戏,并且它将新的高分增加到旧的高分并且他们使数字动画上下.它看起来非常酷,视觉上很有吸引力.
任何人都可以向我解释这是如何做到的?如果这个问题很容易解决,我很抱歉,就像我说我还在努力学习/完善动画一样.
提前致谢
pas*_*aya 10
我从塞尔吉奥的帖子中提出你看过的代码,但注意到安舒提到你想要一个上下移动动画而不是一个淡入/淡出动画,所以我改变了代码以适合你想要的.干得好:
// Add transition (must be called after myLabel has been displayed)
CATransition *animation = [CATransition animation];
animation.duration = 1.0; //You can change this to any other duration
animation.type = kCATransitionMoveIn; //I would assume this is what you want because you want to "animate up or down"
animation.subtype = kCATransitionFromTop; //You can change this to kCATransitionFromBottom, kCATransitionFromLeft, or kCATransitionFromRight
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
[myLabel.layer addAnimation:animation forKey:@"changeTextTransition"];
// Change the text
myLabel.text = newText;
Run Code Online (Sandbox Code Playgroud)
希望这可以帮助!
| 归档时间: |
|
| 查看次数: |
4523 次 |
| 最近记录: |