Search code examples
swiftsprite-kitactionspritebrightness

Adjust Sprite's Brightness


I have a button which when touched, I would like it to shrink and darken slightly. It's easy enough to shrink the button (SKAction.scaleTo), but I can't seem to find a way of darkening it (I'm not actually sure if it is possible to darken a sprite with an SKAction).

I can add a solid black sprite over the top of the button and adjust the alpha to darken when touched, but before I implement this into my code, I just wanted to make sure there wasn't something simpler available that I just haven't discovered yet.


Solution

  • SKAction.colorizeWithColor or SKAction.colorizeWithBlendFactor may help you