我正在尝试使flashBackground的背景闪烁白色。我如何使用Sprite Kit做到这一点。我创建了SKSpriteNode,在其下我想从clearcolor闪烁到whitecolor到clearcolor。
flashBackground = [SKSpriteNode spriteNodeWithColor:[SKColor clearColor] size:
CGSizeMake(self.size.width, self.size.height)];
[self addChild:flashBackground];
最佳答案
SKAction *wait0 = [SKAction waitForDuration:1.0]; // 1 sec delay
SKAction *block0 = [SKAction runBlock:^{
flashBackground.color = [SKColor whiteColor];
}];
SKAction *block1 = [SKAction runBlock:^{
flashBackground.color = [SKColor clearColor];
}];
[flashBackground runAction:[SKAction repeatActionForever:[SKAction sequence:@[wait0, block0, wait0, block1]]]];
或仅将最后一行更改为:
[flashBackground runAction:[SKAction sequence:@[wait0, block0, wait0, block1]]];
关于ios - 背景色Flash Sprite套件,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23375934/