func buildLOTAnimationView(_ resourceUrl: String) throws -> LOTAnimationView { //网络下载 let lotView = try LOTAnimationView(contentsOf: URL(string: "")) //本地加载 let zipPath = MyCache.cacheDataPath(for: resourceUrl) let lotView = try LOTAnimationView.animation(withFilePath: "\(zipPath!)/data.json", error: ()) lotView.frame = UIScreen.main.bounds lotView.contentMode = .scaleAspectFill lotView.loopAnimation = true lotView.play() return lotView }
//1.读取PAG素材文件, pagPath为pag动画的模版文件 pagFile = PAGFile.load(pagPath) //2.替换模版资源 private func replacePag(image: UIImage, index: Int) { let pagImage = PAGImage.fromCGImage(image.cgImage) pagImage?.setScaleMode(PAGScaleModeZoom) pagFile?.replaceImage(Int32(index), data: pagImage) } private func replacePag(text: String, index: Int) { let pagText = pagFile?.getTextData(Int32(index)) pagText?.text = text pagFile?.replaceText(Int32(index), data: pagText) } //3.创建PAG播放视图PAGView self.pagView = PAGView.init(frame: self.view.bounds) if let pagView = self.pagView { //关联PAGView和PAGFile pagView.setComposition(self.pagFile) pagView.setRepeatCount(0) pagView.setMaxFrameRate(30) pagView.setCacheScale(0.8) }
随着前端开发者开发的功能越来越多,对快速控件各类功能的切换、灰度、降级能力也越来越高。那么怎样才能既保证触达信息能力,又能满足低成本的要求呢?其实,Switchquery配置平台就可以满足这些要求。