The values set by setValueProvider are kept internally and transferred between Animation Layers
Actual Behavior
The following code is not working on tvOS because Lottie created CoreAnimationLayer when assigning animation of the view
In CoreAnimationLayer.display(), it fails to setupAnimation() due The Core Animation rendering engine doesn't currently support applying trims to filled shapes
create MainThreadAnimationLayer for fallback handling
the valueProviders are not transferred to the new animation layer
let savingAnimationView = LottieAnimationView()
savingAnimationView.animation = LottieAnimation.named("CloudUpdating")
let colorProvider = ColorValueProvider(UIColor(verkada: .charcoal).lottieColorValue)
let keyPath = AnimationKeypath(keypath: "**.Color")
savingAnimationView.setValueProvider(colorProvider, keypath: keyPath)
savingAnimationView.play()
savingAnimationView.loopMode = .loop
addArrangedSubview(savingAnimationView)
savingAnimationView.size(CGSize(width: 40, height: 40))
I have added the code at the end of fileprivate func makeAnimationLayer(usingEngine renderingEngine: RenderingEngineOption) method of LottieAnimationView, but not sure it will not cause any issue
valueProviders.forEach({ valueProvider in
animationLayer.setValueProvider(valueProvider.value, keypath: valueProvider.key)
})
Which Version of Lottie are you using?
Lottie 4.2.0
Expected Behavior
The values set by
setValueProvider
are kept internally and transferred between Animation LayersActual Behavior
CoreAnimationLayer
when assigninganimation
of the viewCoreAnimationLayer.display()
, it fails tosetupAnimation()
dueThe Core Animation rendering engine doesn't currently support applying trims to filled shapes
MainThreadAnimationLayer
for fallback handlingvalueProviders
are not transferred to the new animation layerI have added the code at the end of
fileprivate func makeAnimationLayer(usingEngine renderingEngine: RenderingEngineOption)
method ofLottieAnimationView
, but not sure it will not cause any issueAnimation JSON