'How to set the opacity of sprite in p5.play?
In p5.play I want to set a sprite's opacity(like Fade). How can I do that?
sprite.opacity = 0.5 //something like that
Solution 1:[1]
There are two ways you can do this, depending on what you're trying to make transparent.
- Changing the color
This method can only be used if you don't plan on adding images to your sprites. We can use this basic function:
sprite.shapeColor.setAlpha(50)
As I said, this method can only be used with colors.
- Changing the images
It is by no means efficient, but it technically works
tint(255, 0-255);
drawSprites(sprite);
tint(255)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | TheDiamondfinderYT |
