更改带淡入淡出效果的背景颜色
答
我用这个代码:
self.run(SKAction.colorize(with: UIColor.white, colorBlendFactor: 1,
duration: 10))
答
UIView.animate(withDuration: 1, animations: {
self.viewForBackGroundChange.backgroundColor = UIColor.red
})
这应该有效。我在这里拿了一个视图的例子,用你希望使用哪个组件的背景层替换它。
这似乎瞬间就变为红色。 UIView.animate(withDuration:10,动画:{ self.backgroundColor = UIColor.red } –
是的,玩的持续时间,这对你有用 –
即使我将持续时间设置为10,000,它仍然会立即改变。 –