繁体   English   中英

如何在Spritely上更改Sprite动画的速度?

[英]How to change speed of a sprite animation on Spritely?

我已经一遍又一遍地阅读Spritely文档,但找不到解决方案。

我有一个4帧的精灵。 我想对其进行无穷无尽的动画处理,但每次迭代:第一帧为99毫秒,接下来的3帧为11毫秒。

如何实现第一帧的放慢速度?

这样做的语法完全不清楚,我尝试过的所有方法都失败了。

在此先感谢您的帮助 :)

$('#test')
.sprite({fps: 6, no_of_frames: 4})
});

从我的发现中,有些调用可以提高速度,例如随机调用。 因此,他们给出了示例:

$('#bird')
      .sprite({fps: 8, no_of_frames: 3})
      .spRandom({
          top: 70,
          left: 100,
          right: 200,
          bottom: 340,
          speed: 4000,
          pause: 3000
      });

允许速度。 Sprite调用似乎没有。 另一个速度属性似乎是在背景上说的,但值得一试。 他们的例子:

$('#trees').pan({fps: 30, speed: 2, dir: 'left'});

要么

$('#hills').spSpeed(20); 

至于问题的第二部分,精灵可以通过on_frame函数在N帧上执行任何操作。 同样,根据他们的文档:

on_frame: { // note - on_frame is an object not a function
        8: function(obj) { // called on frame 8
            obj.spState(2); // change to state 2 (row 2) on frame 8
        },
        16: function(obj) { // called on frame 16
            obj.spState(3); // change to state 3 (row 3) on frame 16
        }
    }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM