如何正确在iOS平台使用 pagview进行重复动画/不重复动画的连续加载 #1203
-
问题: 连续播放2个动画,第一个动画是重复的(setRepeatCount(0) ),执行一段时间后,再播放第二个动画,第二个动画不是重复的(setRepeatCount(1) ),PAGView是同一个,通过 setComposition 切换动画. 结果第二个动画加载异常,无法准确显示出动效.按照官方说法,应该是支持同一个pagview加载不同动效的.所以这种情况是bug还是使用姿势不正确呢? override func viewDidLoad() { P24IOvwF5RBf0Vsdsp2v5VtCl6M21EX0KoU2aNjF.zip
所以官方不关注我的问题吗?
切换的时候要把进度更新到0才行。 调用一下setProgress(0), 不然是按照上次的进度继续播放。
如果切换时设置了progress为0了还是不符合预期,可能并不是进度问题,而是有首帧解码的延迟。你这种需要平滑切换的场景,建议是使用两个PAGView来切换,背后的那个提前调用一下首帧的flush。会确保所有的内容解码完成。你切换的时候就可以实现完全平滑的了。具体在内部,PAGView虽然支持切换PAGFile,但这个是一个非常耗时的操作,所有的缓存都会被彻底删除然后重建。只有你完全不需要再继续使用上一个PAFile的时候才会这样使用。如果需要平滑的切换,用两个View才是最佳的方式。 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
The above content was transferred from a legacy post on the PAG forum |
Beta Was this translation helpful? Give feedback.
-
PAGView如何切换PAGFile,setComposition之后再play吗? |
Beta Was this translation helpful? Give feedback.
The above content was transferred from a legacy post on the PAG forum
以上内容搬运来自 PAG 论坛的历史帖子