收藏
回答

pag动画播放一次就停了,无法循环播放?


尝试了两个设置:setLoop, setRepeatCount均无效。有没有其他的方法能够设置动画无限播放呢?

import { PAGInit } from 'libpag-miniprogram';
    
async onReady() {
    this.PAG = await PAGInit({
      locateFile: (file) => {
        const filePath = '/utils/' + file;
        console.log('Trying to load .wasm file from: ', filePath);
        return filePath;
    }});


    wx.createSelectorQuery()
  .select('#pag')
  .node()
  .exec(async (res) => {
    const canvas = res[0].node;
    const buffer = await loadFileByRequest('xxxx');
    const pagFile = await this.PAG.PAGFile.load(buffer);
    const pagView = await this.PAG.PAGView.init(pagFile, canvas);


    // 这种方式无效
    pagView.setLoop(true);
    pagView.play();
    });

回答关注问题邀请回答
收藏
登录 后发表内容