关于pagVIew使用进度回调问题
@kevingpqi123 is already working on this.
Since Jan 10, 2024.
- Dominant language
- HTML
- Stars
- 5.8k
- Forks
- 531
- Avg merge
- 8d 55m
- Merged PRs (30d)
- 17
Description
【版本信息】
4.2.100
【平台信息】
Android 原生
【预期的表现】
pagView.apply {
composition = PAGFile.Load(assets, "pag/pag_birthday_cake.pag")//文件大概有900kb
setScaleMode(PAGScaleMode.Zoom)
addListener(object : PAGView.PAGViewListener {
override fun onAnimationStart(view: PAGView?) {
LogHelper.e("onAnimationStart")
}
override fun onAnimationEnd(view: PAGView?) {
LogHelper.e("onAnimationEnd state->$isStop")
if (isStopCake) {//结束动画
//自己的逻辑
}
}
override fun onAnimationCancel(view: PAGView?) {
LogHelper.e("onAnimationCancel")
}
override fun onAnimationRepeat(view: PAGView?) {
LogHelper.e("onAnimationRepeat")
}
override fun onAnimationUpdate(p0: PAGView) {
LogHelper.e("onAnimationUpdate")
if (!isStop) {
val process = p0.progress
LogHelper.e("onAnimationUpdate->$process")
if (process >= 0.8) {
p0.progress = 0.0
play()
}
}
}
})
play()//播放
}
我的需求是控制动画在特定情况下(isStop为false)只播放前面80%的帧率,通过判断pagview.progress。等到isStop为true就停止获取进度,然后播放完成最后一次。大多数情况下正常,在重复打开关闭页面播放动画会偶尔出现获取progress异常,日志如下:
【实际的情况】
-》onAnimationStart
-》onAnimationUpdate
-》onAnimationUpdate process->1.0
-》onAnimationUpdate
-》onAnimationUpdate process->3 333333333333334E-4
-》onAnimationUpdate
-》onAnimationUpdate process->3.333333333333334E-4onAnimationUpdate
-》onAnimationUpdate
-》onAnimationUpdate process->1.0
-》onAnimationEnd: state->false
-》onAnimationUpdate
-》onAnimationupdate process->3.333333333333334E-4
-》onAnimationUpdate
-》onAnimationupdate process->3.333333333333334E-4
文件大小大约900kb,日志中会在第一次play()就出现进度为1的情况。希望能帮忙解决一下,期待您的答复。
【Demo及附件】
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.