动画结束进入初始值
我在按钮上运行动画,在其中更改不透明度。动画完成后,所有按钮的不透明度都会恢复到初始值。代码:
CABasicAnimation animation = CABasicAnimation.FromKeyPath("opacity");
animation.To = NSNumber.FromFloat( 0.1f );
animation.Duration = animationDuration;
animation.TimingFunction = CAMediaTimingFunction.FromName (CAMediaTimingFunction.EaseOut);
如何设置动画保持在To值?
I run an animation on my buttons where I change i.e. Opacity. When the animation is complete all the button's Opacity goes back to initial values. The code:
CABasicAnimation animation = CABasicAnimation.FromKeyPath("opacity");
animation.To = NSNumber.FromFloat( 0.1f );
animation.Duration = animationDuration;
animation.TimingFunction = CAMediaTimingFunction.FromName (CAMediaTimingFunction.EaseOut);
How can I set the animation to stay in the To value?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我没有在代码中看到错误,但是还有另一种方法可以代替
CoreAnimation
来实现这一点,这有点冗长。对于 UIKit 元素,使用 UIView.Animate 方法通常更容易。所以,你的样本将是:
I don't see the error in the code, but there is another way to do that instead of
CoreAnimation
, which is a bit verbose.For UIKit elements it is usually easier to use the
UIView.Animate
method. So , your sample would be: