You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This discussion was converted from issue #2097 on July 04, 2023 15:12.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
My code:
import Foundation
import Lottie
import UIKit
class CustomAnimationImageProvider :AnimationImageProvider {
}
func imageForAsset(asset: ImageAsset) -> CGImage? {
// if
// asset.directory.hasPrefix("https:"),
// let url = URL(string: asset.directory + asset.name),
// let data = try? Data(contentsOf: url),
// let image = UIImage(data: data)
// {
// return image.cgImage
// }
if asset.directory.hasPrefix("https:")
{
let path = asset.id
if imgCache[path] == nil {
imgCache[path] = path
downloadImage(asset.directory + asset.name) {
image, urlString in
if let imageObject = image {
// performing UI operation on main thread
DispatchQueue.main.async {
self.dataCache[asset.id] = imageObject
self.view.layoutSubviews()
self.view.reloadImages()
}
Lottie 4.2.0
Expected Behavior
Actual Behavior
Animation JSON
{"v":"5.6.9","fr":40,"ip":0,"op":165,"w":420,"h":420,"nm":"合成 1","ddd":0,"assets":[{"id":"image_0","w":143,"h":143,"u":"https://p1.music.126.net/g7O3fXseRtDKfiqLpQSV-g==/","p":"109951165439360647.png","e":0},{"id":"image_1","w":1440,"h":1440,"u":"https://p1.music.126.net/g7O3fXseRtDKfiqLpQSV-g==/","p":"109951165439360647.png","e":0},{"id":"image_2","w":1440,"h":1440,"u":"https://p1.music.126.net/g7O3fXseRtDKfiqLpQSV-g==/","p":"109951165439360647.png","e":0}],"layers":[{"ddd":0,"ind":1,"ty":2,"nm":"Star.png","cl":"png","refId":"image_0","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":27,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":30,"s":[100]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":116,"s":[100]},{"t":120,"s":[0]}],"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":22,"s":[-429]},{"t":125,"s":[0]}],"ix":10},"p":{"a":0,"k":[340.25,101.75,0],"ix":2},"a":{"a":0,"k":[71.5,71.5,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[0.98,0.98,-2.825]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":27,"s":[2.273,2.273,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0.986,0.986,32.301]},"t":36,"s":[16.248,16.248,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":112,"s":[18.666,18.666,100]},{"t":120,"s":[2.273,2.273,100]}],"ix":6}},"ao":0,"ip":13,"op":813,"st":13,"bm":0},{"ddd":0,"ind":2,"ty":2,"nm":"Star.png","cl":"png","refId":"image_0","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":21,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":24,"s":[100]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":110,"s":[100]},{"t":114,"s":[0]}],"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":16,"s":[-429]},{"t":119,"s":[0]}],"ix":10},"p":{"a":0,"k":[106,260,0],"ix":2},"a":{"a":0,"k":[71.5,71.5,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,-0.405]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":21,"s":[2.273,2.273,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,11.865]},"t":30,"s":[16.673,16.673,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":106,"s":[17.58,17.58,100]},{"t":114,"s":[2.273,2.273,100]}],"ix":6}},"ao":0,"ip":7,"op":807,"st":7,"bm":0},{"ddd":0,"ind":3,"ty":2,"nm":"Star.png","cl":"png","refId":"image_0","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":14,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":17,"s":[100]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":103,"s":[100]},{"t":107,"s":[0]}],"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":9,"s":[-429]},{"t":112,"s":[0]}],"ix":10},"p":{"a":0,"k":[127,76,0],"ix":2},"a":{"a":0,"k":[71.5,71.5,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":14,"s":[2.273,2.273,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":22,"s":[27.273,27.273,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":99,"s":[27.273,27.273,100]},{"t":107,"s":[2.273,2.273,100]}],"ix":6}},"ao":0,"ip":0,"op":800,"st":0,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"Ellipse 13","parent":6,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[0,201.22,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[10,10],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[84.192,84.192],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"Ellipse 13","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":800,"st":0,"bm":0},{"ddd":0,"ind":5,"ty":4,"nm":"Ellipse 12","parent":6,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[0,-202.904,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[10,10],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[84.192,84.192],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"Ellipse 12","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":800,"st":0,"bm":0},{"ddd":0,"ind":6,"ty":4,"nm":"Rectangle 678","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":0,"s":[17.38,210.893,0],"to":[64.333,0,0],"ti":[-64.333,0,0]},{"i":{"x":0.667,"y":0.667},"o":{"x":0.333,"y":0.333},"t":32,"s":[403.38,210.893,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":107,"s":[403.38,210.893,0],"to":[-64.333,0,0],"ti":[64.333,0,0]},{"t":138,"s":[17.38,210.893,0]}],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"rc","d":1,"s":{"a":0,"k":[2,478],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":0,"ix":4},"nm":"矩形路径 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[84.192,84.192],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"Rectangle 678","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":800,"st":0,"bm":0},{"ddd":0,"ind":7,"ty":2,"nm":"Rectangle 627","refId":"image_1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[210,210.052,0],"ix":2},"a":{"a":0,"k":[720,720,0],"ix":1},"s":{"a":0,"k":[28.064,28.064,100],"ix":6}},"ao":0,"hasMask":true,"masksProperties":[{"inv":false,"mode":"a","pt":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":0,"s":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[38.275,-7.382],[-14.033,-7.09],[-14.033,1449.993],[38.275,1449.701]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":32,"s":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[1409.241,-7.382],[-14.033,-7.09],[-14.033,1449.993],[1409.241,1449.701]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":107,"s":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[1409.241,-7.382],[-14.033,-7.09],[-14.033,1449.993],[1409.241,1449.701]],"c":true}]},{"t":138,"s":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[38.275,-7.382],[-14.033,-7.09],[-14.033,1449.993],[38.275,1449.701]],"c":true}]}],"ix":1},"o":{"a":0,"k":100,"ix":3},"x":{"a":0,"k":0,"ix":4},"nm":"蒙版 1"}],"ip":0,"op":800,"st":0,"bm":0},{"ddd":0,"ind":8,"ty":2,"nm":"Rectangle 679","refId":"image_2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[210,210.052,0],"ix":2},"a":{"a":0,"k":[720,720,0],"ix":1},"s":{"a":0,"k":[28.064,28.064,100],"ix":6}},"ao":0,"ip":0,"op":800,"st":0,"bm":0}],"markers":[]}
Beta Was this translation helpful? Give feedback.
All reactions