我该怎么做?
我试过了,但没有效果
var spriteSheet = new createjs.SpriteSheet({
framerate: 60,
"images": [loader.getResult("ball")],
"frames": {"regX": 32, "height": 64, "regY": 32, "width": 64},
// define two animations, run (loops, 1.5x speed) and jump (returns to run):
"animations": {
"run": [0, 63, "run", 1.5]
}
});
ball = new createjs.Sprite(spriteSheet,"run")
ball.x = 50;
ball.y = 50;
ball.filters = [
new createjs.ColorFilter(0,1,1,1, 0,0, 0,0) // has no effect
];
stage.addChild(ball);
stackoverflow希望我在发布此
之前发布更多详细信息图像是黑白的,我想要将其着色,因为我想要删除红色通道,因此RGB(155,155,155)变为RGB(0,155,155)
答案 0 :(得分:0)
你忘了cache。例如,如果ball
是100x100
,那么您可以使用此代码:
ball = new createjs.Sprite(spriteSheet,"run")
ball.x = 50;
ball.y = 50;
ball.filters = [
new createjs.ColorFilter(0,1,1,1, 0,0, 0,0) // has no effect
];
ball.cache(0,0, 100, 100);
stage.addChild(ball);