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

如何针对同一个可视对象连续执行缓动动画? #109

Closed
ben-yip opened this issue Dec 12, 2017 · 2 comments
Closed

如何针对同一个可视对象连续执行缓动动画? #109

ben-yip opened this issue Dec 12, 2017 · 2 comments
Labels

Comments

@ben-yip
Copy link

ben-yip commented Dec 12, 2017

需求: 同一个可视对象,要沿着一个设定的路径移动(一段折线);
目前的做法: 用 Tween 的 link 方法连起来;
遇到问题:

  • link方法的参数需要一个 Tween 实例,创建这个实例时就需要传入这个可视对象,以及指定本次的fromProperties 为上一次动画的 toProperties,这样写起来有点蠢。(代码见下)
  • 不过主要的问题是,在执行 Tween 的构造方法后,该目标可视对象的初始状态会被设置为 fromProperties参数,效果就是,box 最开始会在(100,100) 的位置出现,第一段动画的delay200过后,才依次执行两段动画。
  • 再者,如果像连写多个link,那个中间的动画会被忽略,只执行头尾两段动画。
// box 是一个 Bitmap,原始位置在(0,0)
Hilo.Tween.to(
    box,
    {x: 100, y: 100},
    {delay: 200, duration: 500}
).link(
    new Hilo.Tween(
        box,
        {x: 100, y: 100},
        {x: 300, y: 300},
        {delay: '+0', duration: 500}
    )
)

我觉得是我打开方式错误了,这个情况应该怎么写呢?

@06wj
Copy link
Member

06wj commented Dec 13, 2017

这个是因为 link 方法返回的是调用者本身 所以多个link其实都是放在第一个对象里了

06wj added a commit that referenced this issue Dec 13, 2017
@06wj
Copy link
Member

06wj commented Dec 13, 2017

@ben-yip v1.1.6 修复了这个bug, fromProperties 改成真正start后才会设置
demo

@06wj 06wj added the bug label Dec 13, 2017
@06wj 06wj closed this as completed Dec 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants