easelJS -模拟较低的FPS在确定的动作

easelJS - Simulating lower FPS on determined action

本文关键字:FPS 模拟 easelJS      更新时间:2023-09-26

是否可以像这样创建重复的框架:

character = new createjs.SpriteSheet({
        images: [img],
        frames: {width: frameW, height: frameH, regX: frameW/2, regY: frameH/2},
        animations: { run: [0,9, "run"],
                      hit: [10,10,11,11,12,12,13,13,14,14,15,15, "idle"],
                      jmp: [18,22, "idle_jmp"],
                      idle_jmp: [22],
                      idle: [2]
             }
    });

每帧重复命中两次,以模拟较低的FPS只是命中动作发生!

除了olsn提供的基于代码的频率解决方案之外,您还可以在SpriteSheet数据中指定"频率"。

示例"hit"动画的格式不正确。你可以给我们一个简单的格式:


hit: [startFrame, endFrame, "nextAnimation", frequency],
// For example:
hit: [10,15,"idle",2]

Or you can use a more complex definition with each frame, and specify the other properties by name:


hit: {
    frames: [10,11,12,13,14,15],
    next: "idle",
    frequency:2
}

查看SpriteSheet文档中的主要概述:http://www.createjs.com/Docs/EaselJS/classes/SpriteSheet.html

您可以使用:

character.getAnimation('run').frequency = 2 or whatever frequency you like

你可以在运行时为每个单独的动画设置。