DragonBones / DragonBonesJS

DragonBones TypeScript / JavaScript Runtime
MIT License
746 stars 321 forks source link

AnimationState. timeScale 对于子骨架无效 #137

Open finscn opened 4 years ago

finscn commented 4 years ago

当动画存在子骨架时, AnimationState的 timeScale并不能正常控制子骨架.

我测试的用例结构是 主骨骼动画的某个插槽上插入了一个帧动画.

用下列代码无效:

state =animation.play(...);
state.timeScale = timeScale;  

上面的代码 会影响 主骨骼动画, 但是 子骨架上的动画还是正常速度播放.

使用下面的代码能实现我想要的效果

state =animation.play(...);
animation.timeScale = timeScale;  

但是这段代码又会在其他方面不符合我的预期.

finscn commented 4 years ago

看了下源码, 我觉得 AnimationState 也应该和 Animation一样, 增加一个 _inheritTimeScale 属性. 该属性会叠加 AnimationState._parent 的 _inheritTimeScale

finscn commented 4 years ago

AnimationState._playheadState 也有类似问题. 导致 暂停播放时, 子骨架还在播放.