Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加useSharedTicker参数, 以及 静态的公共方法advanceTime(passedTime) #97

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

finscn
Copy link

@finscn finscn commented Apr 3, 2019

其实在实际项目中, 大多数 Pixi的用户 并不会使用 PIXI.ticker.shared , 而且 PIXI的ticker设计的并不好.

所以 这个PR 为DragonBonesJS pixi版本增加了 是否使用 PIXI.ticker.shared 的参数.

参数默认值 是 true, 所以这个改变并不会影响现有的项目.

用法:

    dragonBones.PixiFactory.useSharedTicker = false;
    var factory = dragonBones.PixiFactory.factory;

    // 上面两行代码 可以简化为: (推荐使用 newInstance )
    var factory = dragonBones.PixiFactory.newInstance(false);
    
    // 此时 不会使用 PIXI.ticker.shared

    ... ...

    // 用户可以在 自己的 game loop 函数里使用 下面的方法来更新动画
    dragonBones.PixiFactory.advanceTime(passedTime);

其实在实际项目中, 大多数 Pixi的用户 并不会使用 PIXI.ticker.shared , 而且 PIXI的ticker设计的并不好.

所以 这个PR 为DragonBonesJS pixi版本增加了 是否使用 PIXI.ticker.shared 的参数.

参数默认值 是 true, 所以这个改变并不会影响现有的项目.

用法: 
```
    dragonBones.PixiFactory.useSharedTicker = false;
    var factory = dragonBones.PixiFactory.factory;

     // 此时 不会使用 PIXI.ticker.shared

    //   用户可以在 自己的 game loop 函数里使用 下面的方法来更新动画
    dragonBones.PixiFactory.advanceTime(passedTime);
```
@rtalon83
Copy link
Contributor

rtalon83 commented Apr 4, 2019

Good idea!

You can use GSAP ticker "TweenLite/TweenMax.ticker" to direct DragonBones, for example.

Merged in my fork.

@akdcl
Copy link
Member

akdcl commented Apr 4, 2019

其实,龙骨已经提供了开发者自己驱动所有动画的,而不是使用默认时钟的选项,就是将每个 armature 实例的 clock 指向开发者自己实例化的 clock,这样就脱离了内置的默认 clock 控制,当然可能会觉得设置每个armature 实例的方法会有些繁琐

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants