Lottie-ios。应用颜色叠加

时间:2019-09-27 06:47:21

标签: ios objective-c lottie lottie-ios


如何在动画上应用颜色叠加?我有一个非常简单的单色图标。我想使它们在黑暗模式下可用,而不用不同颜色在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类。
谢谢!

1 个答案:

答案 0 :(得分:0)

据我所知(requestdocs)尚无“支持”黑暗模式。

也许这样的事情对¯\ _(ツ)_ /¯

有帮助
    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)
    }