iOS Sprite Kit为什么我不能用白色重复colorizeWithColor? [英] iOS Sprite Kit why can't I repeat colorizeWithColor using white color?

查看:194
本文介绍了iOS Sprite Kit为什么我不能用白色重复colorizeWithColor?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用除scale之外的方法来选择sprite节点的方法。我最喜欢的一种方法是使用白色着色,这会明显突出显示节点。

I'm experimenting with ways of selecting sprite nodes using methods other than scale. The one method that I like the most is colorize with white, which highlights the node visibly.

然而,我似乎无法复制具有白色行为的着色更多不止一次。 为什么我不能多次使用白色来应用 colorizeWithColor

However, I cannot seem to be able to replicate the colorize with white behavior more than once. Why can't I apply colorizeWithColor using white color more than once?

这些除了使用的颜色外,两个方法调用是相同的。如果我使用红色,灰色等,节点会通过闪烁来响应每次触摸。但如果我使用白色,它只会使用一次,然后再也不会响应触摸。

These two method calls are identical, except for the color used. If I use red, gray, etc, the node responds by flashing for each touch. But If I use white, it does so only once, then never responds to touches again.

[self runAction:[SKAction colorizeWithColor:[SKColor lightGrayColor] colorBlendFactor:0.8 duration:0.6] completion:^{

        [self runAction:[SKAction colorizeWithColorBlendFactor:0.0 duration:0.4]];
    }];

    [self runAction:[SKAction colorizeWithColor:[UIColor colorWithWhite:0.99 alpha:1.0] colorBlendFactor:0.8 duration:0.6] completion:^{

        [self runAction:[SKAction colorizeWithColorBlendFactor:0.0 duration:0.4]];
    }];


推荐答案

这很有意思 - 我不确定我有答案。使用白色着色会对节点产生不同于其他颜色的影响。

This is very interesting - and I'm not sure I have the answer. Using a white colorisation does to affect a node differently from other colours.

如果使用 blueColor 并在模拟器中观看,颜色将保留。

if you perform a colorize on a sprite node with blueColor and watch in the simulator, the colour will remain.

[node runAction:[SKAction colorizeWithColor:[SKColor blueColor] colorBlendFactor:0.8 duration:0.6]];

但是,如果在精灵节点上使用 whiteColor执行着色并在模拟器中观看,它似乎会自动展开(即使没有任何完成块)。

However, if you perform a colorize on a sprite node with whiteColor and watch in the simulator, it appears to automatically unwind (even without any completion block).

[node runAction:[SKAction colorizeWithColor:[SKColor whiteColor] colorBlendFactor:0.8 duration:0.6]];

我找不到文件/头文件中可能出现这种情况的原因。还在搜索。

I can find no reference to why this might be the case in documentation/header files. Still searching.

这篇关于iOS Sprite Kit为什么我不能用白色重复colorizeWithColor?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆