{"id":28559041,"url":"https://github.com/sdwebimage/sdwebimagelottiecoder","last_synced_at":"2025-06-10T08:35:58.434Z","repository":{"id":54403303,"uuid":"245801440","full_name":"SDWebImage/SDWebImageLottieCoder","owner":"SDWebImage","description":"A Lottie animation coder which use SDAnimatedImageView instead of LOTAnimationView for bitmap rendering","archived":false,"fork":false,"pushed_at":"2021-02-20T06:39:58.000Z","size":2137,"stargazers_count":49,"open_issues_count":6,"forks_count":22,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-04T02:44:30.944Z","etag":null,"topics":["carthage","cocoapods","ios","lottie","macos","sdwebimage","swiftpm","tvos","watchos"],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SDWebImage.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-08T11:24:46.000Z","updated_at":"2025-02-06T08:59:49.000Z","dependencies_parsed_at":"2022-08-13T14:40:11.575Z","dependency_job_id":null,"html_url":"https://github.com/SDWebImage/SDWebImageLottieCoder","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SDWebImage%2FSDWebImageLottieCoder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SDWebImage%2FSDWebImageLottieCoder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SDWebImage%2FSDWebImageLottieCoder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SDWebImage%2FSDWebImageLottieCoder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SDWebImage","download_url":"https://codeload.github.com/SDWebImage/SDWebImageLottieCoder/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SDWebImage%2FSDWebImageLottieCoder/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259039542,"owners_count":22796853,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["carthage","cocoapods","ios","lottie","macos","sdwebimage","swiftpm","tvos","watchos"],"created_at":"2025-06-10T08:35:57.894Z","updated_at":"2025-06-10T08:35:58.412Z","avatar_url":"https://github.com/SDWebImage.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SDWebImageLottieCoder\n\n[![CI Status](https://img.shields.io/travis/SDWebImage/SDWebImageLottieCoder.svg?style=flat)](https://travis-ci.org/SDWebImage/SDWebImageLottieCoder)\n[![Version](https://img.shields.io/cocoapods/v/SDWebImageLottieCoder.svg?style=flat)](https://cocoapods.org/pods/SDWebImageLottieCoder)\n[![License](https://img.shields.io/cocoapods/l/SDWebImageLottieCoder.svg?style=flat)](https://cocoapods.org/pods/SDWebImageLottieCoder)\n[![Platform](https://img.shields.io/cocoapods/p/SDWebImageLottieCoder.svg?style=flat)](https://cocoapods.org/pods/SDWebImageLottieCoder)\n[![SwiftPM compatible](https://img.shields.io/badge/SwiftPM-compatible-brightgreen.svg?style=flat)](https://swift.org/package-manager/)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/SDWebImage/SDWebImageLottieCoder)\n\n## What's for\n\nThis is a coder plugin for [Lottie Animation format](https://airbnb.design/lottie/).\n\n## Differences\n\nWe've already built one Lottie plugin, called [SDWebImageLottiePlugin](https://github.com/SDWebImage/SDWebImageLottiePlugin).\n\nThe main difference for these two components, it's `How we play animation`, and `What dependency we use`. In order to reduce the code size for unnecessary dependency, we separate these into 2 different repos.\n\n### SDWebImageLottiePlugin\n\nThis lottie framework dependent [lottie-ios](https://github.com/airbnb/lottie-ios), which is maintained by Airbnb.\n\nThis plugin can only play animation by using their own `LOTAnimationView`.\n\n+ Pros: It use vector rendering technology like Core Animation Layer, which means you can change your view dynamic size without lossing details or regenerate images.\n\n+ Cons: Vector rendering is much slower than bitmap rendering. For small and massive lottie images, like emojis, small icons, this is not suitable.\n\n### SDWebImageLottieCoder\n\nThis lottie framework dependent [rlottie](https://github.com/Samsung/rlottie), which is maintained by Samsung.\n\nThis plugin can play animation on both [SDAnimatedImageView](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#animated-image-50) and `UIImageView/NSImageView`.\n\n+ Pros: It use bitmap rendering, each animation frame are rendered into the rasterized bitmap, not vector images. You can also preload all frames into memory, to get the best performance and 60FPS. This is also easy to integrate to UIKit/AppKit native framework.\n\n+ Cons: Bitmap rendering does not support dynamic size changes. Once you want larger images, you need re-decoding the source lottie JSON, which is time-consuming and RAM consuming.\n\n## Example\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\n\n## Requirements\n\n+ iOS 9+\n+ macOS 10.11+\n+ tvOS 9.0+\n+ watchOS 2.0+\n+ Xcode 11+\n\n## Installation\n\n#### CocoaPods\nSDWebImageLottieCoder is available through [CocoaPods](https://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'SDWebImageLottieCoder'\n```\n\n#### Carthage\n\nSDWebImageLottieCoder is available through [Carthage](https://github.com/Carthage/Carthage).\n\n```\ngithub \"SDWebImage/SDWebImageLottieCoder\"\n```\n\n#### Swift Package Manager (Xcode 11+)\n\nSDWebImageLottieCoder is available through [Swift Package Manager](https://swift.org/package-manager).\n\n```swift\nlet package = Package(\n    dependencies: [\n        .package(url: \"https://github.com/SDWebImage/SDWebImageLottieCoder.git\", from: \"0.1\")\n    ]\n)\n```\n\nSDWebImageLottieCoder is available through [CocoaPods](https://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'SDWebImageLottieCoder'\n```\n\n## Usage\n\n### Add Coder\n\nBefore using SDWebImage to load Lottie json, you need to register the Lottie Coder to your coders manager. This step is recommended to be done after your App launch (like AppDelegate method).\n\n+ Objective-C\n\n```objective-c\n// Add coder\nSDImageLottieCoder *lottieCoder = [SDImageLottieCoder sharedCoder];\n[[SDImageCodersManager sharedManager] addCoder:lottieCoder];\n```\n\n+ Swift\n\n```swift\n// Add coder\nlet lottieCoder = SDImageLottieCoder.shared\nSDImageCodersManager.shared.addCoder(lottieCoder)\n```\n\n### Loading\n\n+ Objective-C\n\n```objective-c\n// Lottie json loading\nNSURL *lottieURL;\nUIImageView *imageView;\n[imageView sd_setImageWithURL:lottieURL];\n```\n\n+ Swift\n\n```swift\n// Lottie json loading\nlet lottieURL: URL\nlet imageView: UIImageView\nimageView.sd_setImage(with: lottieURL)\n```\n\n### Animation and Size\n\n+ Objective-C\n\n```objective-c\n// Lottie json loading on animated image view\nNSURL *lottieURL;\nSDAnimatedImageView *imageView;\nCGSize pixelSize = CGSizeMake(300, 300);\n[imageView sd_setImageWithURL:lottieURL placeholderImage:nil options:0 context:@{SDWebImageThumbnailPixelSize:@(pixelSize)}];\n```\n\n+ Swift\n\n```swift\n// Lottie json loading on animated image view\nlet lottieURL: URL\nlet imageView: SDAnimatedImageView\nlet pixelSize = CGSize(width: 300, height: 300)\nimageView.sd_setImage(with: lottieURL, placeholderImage: nil, options: [], contrext: [.thumbnailPixelSize : pixelSize])\n```\n\n### Decoding\n\nYou can decode lottie image into aniamted UIImage/NSImage as well. If the lottie images have [referenced external image resource](https://airbnb.io/lottie/#/supported-features), you can specify it as well.\n\n+ Objective-C\n\n```objective-c\n// Lottie image decoding\nNSData *lottieJSONData;\nNSBundle *imageBundle; // You can even download the external image from online to local path, then load the lottie animation\nUIImage *image = [[SDImageLottieCoder sharedCoder] decodedImageWithData:lottieJSONData options:@{SDImageCoderDecodeLottieResourcePath : imageBundle.resourcePath}];\n```\n\n+ Swift\n\n```swift\n// Lottie image decoding\nlet lottieJSONData: Data\nlet imageBundle: Bundle // You can even download the external image from online to local path, then load the lottie animation\nlet image = SDImageWebPCoder.shared.decodedImage(with: lottieJSONData, options: [.lottieResourcePath : imageBundle.resourcePath])\n```\n\n## Screenshot\n\n\u003cimg src=\"https://raw.githubusercontent.com/SDWebImage/SDWebImageLottieCoder/master/Example/Screenshot/LottieDemo.gif\" width=\"300\" /\u003e\n\nThese Lottie animation stickers are from [lottiefiles-telegram](https://lottiefiles.com/animated-stickers/animated-contest-4-at-tgsticker)\n\n## Author\n\nDreamPiggy, lizhuoli1126@126.com\n\n## License\n\nSDWebImageLottieCoder is available under the MIT license. See the LICENSE file for more info.\n\n## Thanks\n\n+ [rlottie](https://github.com/Samsung/rlottie)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsdwebimage%2Fsdwebimagelottiecoder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsdwebimage%2Fsdwebimagelottiecoder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsdwebimage%2Fsdwebimagelottiecoder/lists"}