How to use png images with Lottie iOS?

lottie-ios storyboard
lottie splash screen ios
lottie preview
lottie github
lottie loader
ios animationview
lottie localization
lottie testing

I tried exporting an after effect file with bodymovin, that after effect file has a few png images. How do we use this with Lottie in iOS? Do we include those images in the asset catalog, and use them alongside the json file?

According to this function

https://github.com/airbnb/lottie-ios/blob/973c08da8ccf3dbc171bcd9e8748e6368c5a2107/lottie-ios/Classes/AnimatableLayers/LOTLayerContainer.m#L126

It tries to load it different ways including from the asset catalog -- that's what line 147 in that file would do:

  NSArray *components = [asset.imageName componentsSeparatedByString:@"."];
  image = [UIImage imageNamed:components.firstObject inBundle:asset.assetBundle compatibleWithTraitCollection:nil];

Use image resources in lottie-ios · Issue #167 · airbnb/lottie-ios , Use image resources in lottie-ios #167. Closed For me taking the img_0.png out of images folder and putting alongside the json file worked. Sometimes when I build on a new device or for a new simulator, it seems that the PNG images of the fish (or sometimes other PNGs that the animation uses) get scrambled (kind of looks like a rectangle of some sorts). I haven't been able to pinpoint a pattern yet, it seems to happen pretty randomly.

The answer to your question is YES. Drop in your JSON file and place the images in the assets catalog. I tried it with this sample JSON/assets https://www.lottiefiles.com/1187-puppy-run. One thing to note that on Xcode when you drop the image assets, you may need to move them to 2x.

This is my current setup:

PNG images used by LottieJSON seem to be scrambled · Issue , Check these before submitting: Updated to the latest version of Lottie (2.5.0) The issue doesn't involve an Unsupported Feature This issue PNG images used by LottieJSON seem to be scrambled #576 What Platform are you on? [] MacOS; iOS To show/hide the loading indicator I use the following:. PNG sequence: PNG sequences are even larger in size and still don’t scale properly across different screen density (due to pixel based format), you’ll have to provide your developers with images at @1x, 2x and 3x. Animated Vector Drawable: supported only by Android. This solution performs incredibly well but doesn’t support many features Lottie does (text or dynamic colors).

You can put all images next to the json.

After that you can just play animation:

let animation = LOTAnimationView(name: "LogoAnimation")
animation.play()

Add image support · Issue #73 · airbnb/lottie-ios · GitHub, my animator need to operate some .png img ,build a new folder "images" and put .png file in it . json like this:" { "assets": [ { "id": "image_0", "w":  Hi, I read your code in the 'LOTLayerView.m' file, there is a method called '- (void)_setImageForAsset' to load image resources in our app used in lottie animation. But in the method you use '+ (nullable UIImage *)imageNamed:(NSString *)name;' to load image, which means we can only load images in app's main bundle.

airbnb/lottie-ios, This issue is a: Regression Which Version of Lottie are you using? You just need an animation exported with Bodymovin with a .png image. Why GitHub? Features →. Code review; Project management; Integrations; Actions; Packages; Security

We want to put Lottie's picture in Images.xcassets. Is there any , Lottie is a library for Android, iOS, Web, and Windows that parses Adobe After Effects that exports After effects files as json and includes a javascript web player. We've built on top of his great work to extend its usage to Android, iOS, React Native, Png sequences are even worse than gifs in that their file sizes are often  Assuming you have an animation file, the next thing is to prepare your Xcode project. Similar to other iOS libraries, the easiest way to incorporate Lottie in your Xcode project is by using CocoaPods. Let’s build a quick demo to see how you work with Lottie.

Lottie Docs, We want to show 3D Animation as image sequences in Android or another platform that These situations are a gray area. but Lottie is still a legend. anyway, We have to use image sequences to Select to all of them and Click the import button (Attention/ Png Sequence The design guide to iOS and Android app icons. Where can I use a Lottie? You can use Lotties on basically any platform: web or mobile. This means you can integrate them seamlessly into both apps and web pages. Lottie animations can even be used as stickers on messaging platforms. It isn't technically limited to web and mobile. You could use it on desktop apps as well as some watches

Comments
  • something to consider, it is MUCH, MUCH, MUCH more efficient if you stick to SVG. we never use any PNGs/JPGs, whatsoever, in apps now. (other than for actual photos of course.) surely, your illustrator or designer that created the file, has the original? Just have them export it as an svg and go from there in the Lottie pipeline.... much as you now just use PaintCode for all icons/etc in iOS (and indeed Android), it's really ideal if you can avoid raster files inside Lottie as well !
  • I'd also be curious to know if it's possible to use PDF-based vector images with the library. I was able to get the PNGs rendering fairly easily, but haven't figured out PDF/SVG yet.