Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tvOS: the key values which set with setValueProvider disappearing while switching between .automatic and .mainThread #2163

Closed
joohae-kim opened this issue Aug 29, 2023 · 2 comments · Fixed by #2164
Labels

Comments

@joohae-kim
Copy link

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 Layers

Actual Behavior

  1. The following code is not working on tvOS because Lottie created CoreAnimationLayer when assigning animation of the view
  2. In CoreAnimationLayer.display(), it fails to setupAnimation() due The Core Animation rendering engine doesn't currently support applying trims to filled shapes
  3. create MainThreadAnimationLayer for fallback handling
  4. 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)
    })

Animation JSON

@calda
Copy link
Member

calda commented Aug 29, 2023

Thanks for the report. Fixed in #2164.

@joohae-kim
Copy link
Author

thank you it works on my code also

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants