tfmart / lottieui Goto Github PK
View Code? Open in Web Editor NEWLottieUI is a SwiftUI wrapper for Lottie Animations for iOS
License: MIT License
LottieUI is a SwiftUI wrapper for Lottie Animations for iOS
License: MIT License
HStack {
LottieView("loading").loopMode(.loop)
}.frame(width: 200, height: 200, alignment: .center)
See here for solution?
airbnb/lottie-ios#1050
As of Lottie 4.0, the current solution we have for observing animations with CVDisplayLink and CADisplayLink have stopped working when rendering animations with their new Core Animation engine.
For now, we can use the legacy Main Thread engine to use the framerate/progress observers, but we'll have to sort it out what's causing the display link to break on the newer engine
If anyone has an possible solution in mind, feel free to discuss it below. You're also very welcome to contribute with a pull request!
After just adding the package and building my macOS target it's failing with this build error. Could it be because of the syntax in lottie-ios's RenderingEngineOption.swift
? Some Swift version incompatibility maybe. My environment is on Swift 5.9(swiftlang-5.9.0.128.108 clang-1500.0.40.1). Is there a recommended Swift version to use with LottieUI?
ld: Undefined symbols:
enum case for Lottie.LottieContentMode.scaleAspectFit(Lottie.LottieContentMode.Type) -> Lottie.LottieContentMode, referenced from:
LottieUI.WrappedAnimationNSView.init(animation: Lottie.LottieAnimation?, provider: Lottie.AnimationImageProvider?) -> LottieUI.WrappedAnimationNSView in LottieUI.o
LottieUI.WrappedAnimationNSView.update(withEngine: Lottie.RenderingEngineOption) -> () in LottieUI.o
dispatch thunk of Lottie.LottieAnimationView.realtimeAnimationFrame.getter : CoreGraphics.CGFloat, referenced from:
closure #1 @Swift.MainActor () -> () in LottieUI.AnimationProgressObserver.(tick in _385C634819DA2085EAADFB3078ACC442)() -> () in LottieUI.o
dispatch thunk of Lottie.LottieAnimationView.realtimeAnimationProgress.getter : CoreGraphics.CGFloat, referenced from:
closure #1 @Swift.MainActor () -> () in LottieUI.AnimationProgressObserver.(tick in _385C634819DA2085EAADFB3078ACC442)() -> () in LottieUI.o
dispatch thunk of Lottie.LottieAnimationView.configuration.getter : Lottie.LottieConfiguration, referenced from:
LottieUI.WrappedAnimationNSView.renderingEngine.getter : Lottie.RenderingEngineOption in LottieUI.o
LottieUI.WrappedAnimationNSView.renderingEngine.setter : Lottie.RenderingEngineOption in LottieUI.o
dispatch thunk of Lottie.LottieAnimationView.imageProvider.getter : Lottie.AnimationImageProvider, referenced from:
LottieUI.WrappedAnimationNSView.update(withEngine: Lottie.RenderingEngineOption) -> () in LottieUI.o
dispatch thunk of Lottie.LottieAnimationView.animationSpeed.getter : CoreGraphics.CGFloat, referenced from:
LottieUI.WrappedAnimationNSView.speed.getter : CoreGraphics.CGFloat in LottieUI.o
dispatch thunk of Lottie.LottieAnimationView.animationSpeed.setter : CoreGraphics.CGFloat, referenced from:
LottieUI.WrappedAnimationNSView.speed.setter : CoreGraphics.CGFloat in LottieUI.o
dispatch thunk of Lottie.LottieAnimationView.setValueProvider(_: Lottie.AnyValueProvider, keypath: Lottie.AnimationKeypath) -> (), referenced from:
LottieUI.WrappedAnimationNSView.setValueProvider(_: Lottie.AnyValueProvider?, keypath: Lottie.AnimationKeypath?) -> () in LottieUI.o
dispatch thunk of Lottie.LottieAnimationView.backgroundBehavior.getter : Lottie.LottieBackgroundBehavior, referenced from:
LottieUI.WrappedAnimationNSView.backgroundBehavior.getter : Lottie.LottieBackgroundBehavior in LottieUI.o
dispatch thunk of Lottie.LottieAnimationView.backgroundBehavior.setter : Lottie.LottieBackgroundBehavior, referenced from:
LottieUI.WrappedAnimationNSView.backgroundBehavior.setter : Lottie.LottieBackgroundBehavior in LottieUI.o
dispatch thunk of Lottie.LottieAnimationView.play(completion: ((Swift.Bool) -> ())?) -> (), referenced from:
LottieUI.WrappedAnimationNSView.play(completion: ((Swift.Bool) -> ())?) -> () in LottieUI.o
dispatch thunk of Lottie.LottieAnimationView.play(fromFrame: CoreGraphics.CGFloat?, toFrame: CoreGraphics.CGFloat, loopMode: Lottie.LottieLoopMode?, completion: ((Swift.Bool) -> ())?) -> (), referenced from:
LottieUI.WrappedAnimationNSView.play(fromFrame: CoreGraphics.CGFloat, toFrame: CoreGraphics.CGFloat, loopMode: Lottie.LottieLoopMode, _: ((Swift.Bool) -> ())?) -> () in LottieUI.o
dispatch thunk of Lottie.LottieAnimationView.stop() -> (), referenced from:
LottieUI.WrappedAnimationNSView.stop() -> () in LottieUI.o
dispatch thunk of Lottie.LottieAnimationView.loopMode.getter : Lottie.LottieLoopMode, referenced from:
LottieUI.WrappedAnimationNSView.loopMode.getter : Lottie.LottieLoopMode in LottieUI.o
dispatch thunk of Lottie.LottieAnimationView.loopMode.setter : Lottie.LottieLoopMode, referenced from:
LottieUI.WrappedAnimationNSView.loopMode.setter : Lottie.LottieLoopMode in LottieUI.o
dispatch thunk of Lottie.LottieAnimationView.animation.getter : Lottie.LottieAnimation?, referenced from:
LottieUI.WrappedAnimationNSView.update(withEngine: Lottie.RenderingEngineOption) -> () in LottieUI.o
dispatch thunk of Lottie.LottieAnimationViewBase.contentMode.setter : Lottie.LottieContentMode, referenced from:
LottieUI.WrappedAnimationNSView.init(animation: Lottie.LottieAnimation?, provider: Lottie.AnimationImageProvider?) -> LottieUI.WrappedAnimationNSView in LottieUI.o
LottieUI.WrappedAnimationNSView.update(withEngine: Lottie.RenderingEngineOption) -> () in LottieUI.o
enum case for Lottie.LottieBackgroundBehavior.pause(Lottie.LottieBackgroundBehavior.Type) -> Lottie.LottieBackgroundBehavior, referenced from:
variable initialization expression of LottieUI.LottieConfiguration.(_backgroundBehavior in _3788E42FFA4BE53E59FCB330C0655D1F) : Combine.Published<Lottie.LottieBackgroundBehavior> in LottieUI.o
LottieUI.LottieConfiguration.init() -> LottieUI.LottieConfiguration in LottieUI.o
enum case for Lottie.LottieLoopMode.loop(Lottie.LottieLoopMode.Type) -> Lottie.LottieLoopMode, referenced from:
closure #1 (LottieUI.AsyncLottiePhase) -> SwiftUI._ConditionalContent<SwiftUI._ConditionalContent<SwiftUI.Text, SwiftUI.Text>, LottieUI.LottieView> in static LottieUI.SwiftUIView_Previews.previews.getter : some in LottieUI.o
enum case for Lottie.LottieLoopMode.playOnce(Lottie.LottieLoopMode.Type) -> Lottie.LottieLoopMode, referenced from:
variable initialization expression of LottieUI.LottieConfiguration.(_loopMode in _3788E42FFA4BE53E59FCB330C0655D1F) : Combine.Published<Lottie.LottieLoopMode> in LottieUI.o
LottieUI.LottieConfiguration.init() -> LottieUI.LottieConfiguration in LottieUI.o
enum case for Lottie.DecodingStrategy.dictionaryBased(Lottie.DecodingStrategy.Type) -> Lottie.DecodingStrategy, referenced from:
default argument 1 of Lottie.LottieConfiguration.init(renderingEngine: Lottie.RenderingEngineOption, decodingStrategy: Lottie.DecodingStrategy, colorSpace: __C.CGColorSpaceRef, reducedMotionOption: Lottie.ReducedMotionOption) -> Lottie.LottieConfiguration in LottieUI.o
enum case for Lottie.RenderingEngineOption.automatic(Lottie.RenderingEngineOption.Type) -> Lottie.RenderingEngineOption, referenced from:
variable initialization expression of LottieUI.LottieConfiguration.(_renderingEngine in _3788E42FFA4BE53E59FCB330C0655D1F) : Combine.Published<Lottie.RenderingEngineOption> in LottieUI.o
LottieUI.LottieConfiguration.init() -> LottieUI.LottieConfiguration in LottieUI.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Currently, the Mac version of LottieView do not support observation of the current progress/frame rate of an animation. For the iOS counterpart, I'm using CADisplayLink
to observe the animation, but unfortunately it's not available on AppKit.
If anyone has any suggestion on how I could keep track of the animation's progress on macOS, feel free to let me know! You're also welcome to contribute with a pull request with your implementation if you're feeling extra generous.
Thanks for your help!
Hey would it be possible to sort bind the animation name?
I want to use Lotties on my onboarding screen, where if the user presses next a new animation shows and starts playing center screen.
Hope to hear from you soon!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.