svga / SVGAPlayer-Web

Similar to Lottie. Render After Effects / Animate CC (Flash) animations natively on Android and iOS, Web. 使用 SVGAPlayer 在 Android、iOS、Web中播放 After Effects / Animate CC (Flash) 动画。
https://svga.io
Apache License 2.0
954 stars 239 forks source link

startAnimationWithRange(),location 无效 #18

Closed hanyitim closed 6 years ago

hanyitim commented 6 years ago

startAnimationWithRange({location:0,length:20}) 跟 startAnimationWithRange(location:50,length:20)播放的片段是一样的,播放区间都是[0,20], videoItem.frames 是 151

hanyitim commented 6 years ago

startAnimationWithRange(range: {location: number, length: number}, reverse: boolean = false); - 播放 [location, location+length] 指定区间帧动画 无语掉了,readme.md 上面没有说明 需要传 fromFrame :true 才会按照帧来算,

PonyCui commented 6 years ago

你提供一个 Demo,我看看具体问题?

PonyCui commented 6 years ago

可以发送邮件至 help@svga.io

hanyitim commented 6 years ago

我自己看懵了,startAnimationWithRange 第三参 传 true 是反转着播放了,以为解决问题了。追问题追到了value-animator,看了ts的写法 顿时懵逼啊

hanyitim commented 6 years ago

@PonyCui 已经可以了···· //player.js _doStart(range, reverse, fromFrame) , formFrame 是具体的帧数 在源码把 startAnimationWithRange(range, reverse) { this.stopAnimation(false); this._doStart(range, reverse) }
改成 startAnimationWithRange(range, reverse) { this.stopAnimation(false); this._doStart(range, reverse,range.location) } 就可以了,把location 当成帧数传进去可以行了

hanyitim commented 6 years ago

又发现了个问题(videoItem.frames:151 ) startAnimationWithRange({location:0,length:150}) ,这个时候是可以很完整的播放完成的, 但是 startAnimationWithRange({location:50,length:150}),修改之后,起始帧是50了,不过缺没有播放到150帧

errnull commented 6 years ago

新的提交中已经修复了这个问题,请拉最新的代码。 谢谢您的发现。

zcoding commented 6 years ago

我用npm安装的最新的包并没有解决这个问题啊。。。

PonyCui commented 6 years ago

@zcoding npm 未发布新版