如何在动画上应用颜色叠加?我有一个非常简单的单色图标。我想使它们在黑暗模式下可用,而不用不同颜色在AE中重新渲染。我在文档中看到了示例:
let redValueProvider = ColorValueProvider(Color(r: 1, g: 0.2, b: 0.3, a: 1))
animationView.setValueProvider(redValueProvider, keypath: AnimationKeypath(keypath: "Switch Outline Outlines.**.Fill 1.Color"))
animationView.setValueProvider(redValueProvider, keypath: AnimationKeypath(keypath: "Checkmark Outlines 2.**.Stroke 1.Color"))
但是不知道如何实现它。彩票的Obj-c分支没有ColorValueProvider类。
谢谢!
答案 0 :(得分:0)
也许这样的事情对¯\ _(ツ)_ /¯
有帮助 let keypath = AnimationKeypath(keys: ["Switch Outline Outlines", "**", "Fill 1", "Color"])
let colorProvider: ColorValueProvider
if self.traitCollection.userInterfaceStyle == .dark {
colorProvider = ColorValueProvider(UIColor.white.lottieColorValue)
animationView.setValueProvider(colorProvider, keypath: keypath)
} else {
colorProvider = ColorValueProvider(UIColor.black.lottieColorValue)
animationView.setValueProvider(colorProvider, keypath: keypath)
}