Tencent / Tencent/libpag

PAGImageView 是一个礼物连击按钮动画,播放两次时,没有onAnimationEnd 回调

Open
#2,764 2 comments 0 reactions 1 assignee View on GitHub

@kevingpqi123 is already working on this.

Since Apr 8, 2025.

Dominant language
HTML
Stars
5.8k
Forks
531
Avg merge
8d 55m
Merged PRs (30d)
17

Description

【版本信息】

4.3.71

【平台信息】

Android 原生

【预期的表现】

在连击之前,会先校验状态:
if (isPlaying) {
pause()
},
然后添加监听器:addListener
`val pagViewListener = object : PAGImageViewListener {
override fun onAnimationStart(p0: PAGImageView?) {
KLog.d("-----onAnimationStart")
listener.start()
}

        override fun onAnimationEnd(p0: PAGImageView?) {
            KLog.d("-----onAnimationEnd")
            listener.finish()
            //结束后清空监听
            if(p0 != null) removeListener(pagViewListener)
        }

        override fun onAnimationCancel(p0: PAGImageView?) {
            KLog.d("-----onAnimationCancel")
            //结束后清空监听
            if(p0 != null) removeListener(pagViewListener)
        }

        override fun onAnimationRepeat(p0: PAGImageView?) {}

        override fun onAnimationUpdate(p0: PAGImageView?) {}
    }

addListener(pagViewListener)
val pagFile = PAGFile.Load(context.assets, animName)
composition = pagFile
play()
`
监听打印的日志顺序是:onAnimationStart-->onAnimationCancel-->onAnimationEnd

【实际的情况】

连击按钮播放一次时,是正常的,播放第二次时,没有回调onAnimationEnd,就卡在onAnimationCancel结束了。播放 2 次以上都是正常的。

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.