This property overlays a color on top of a sprite to tint it. This tint doesn't change the existing colors of a sprite, but is more like putting a pane of colored glass over the top of the sprite. Because of this, you may find that sprites with bold or dark colors become darker when you apply a tint.
You can assign the tint color in a number of ways, including:
var red_cow = createSprite(100, 200); red_cow.setAnimation("cow"); red_cow.tint = "red"; var blue_cow = createSprite(200, 200); blue_cow.setAnimation("cow"); blue_cow.tint = "#0000FF"; var ghost_cow = createSprite(300, 200); ghost_cow.setAnimation("cow"); ghost_cow.alpha = 0.5; drawSprites();
sprite.tint = "blue";
The sprite's tint color, or null
if no tint has been applied.
rgb()
as a parameter to fill instead of a color name.rgb()
). If you want to make a sprite semi-transparent without changing it's color, use white as the tint color with an additional alpha transparency parameter (eg rgb(255, 255, 255, 0.5)
for 50% transparent).drawSprites()
is called.Found a bug in the documentation? Let us know at documentation@code.org