Transparent Images

Hey Guys,
I have a question about transparent images. I would like to sign an image transparent (Space Art:Cloudy Nebula). You should see the cloud only slightly. What is the best way ?
Sincerely,
Stoneberger

tint(255,255,255,150)
sprite("Space Art: Cloudy Nebula",X,Y)

Edit put “pushStyle()” before the tint and put “popStyle()” after to draw other images properly

Try using tint(w, x, y, z) before drawing it, with the 4th value (z) being somewhere from 0-255 and the rest being at 255. Don’t forget to noTint() after you’ve drawn it, so other stuff is still opaque!

Edit: @CodeaNoob was faster than me

Edit 2: by 10 minutes… I ought to refresh pages more

@Causeless It’s r, g, b, a, not w, x, y, z. A is alpha, the opposite of transparency, i.e. 255 is completely there, 0 is completely invisible.

@stoneberger note that you can make this transparency withing codea, but if you save the image on ipad disk you’ll loose the transparency (that is a restriction from apple). To get it out, you’ll have to send it directly to dropbox (or elsewhere) from running codea memory.

Yeah I know, but it doesn’t really matter if you call then rgba or wxyz - arguably the second is more preferable in some cases considering it’s more consistent with how vector’s axis’s are typically names.

@Causeless It doesn’t matter what you call it, but I disagree with the second being preferable. This has nothing to do with vectors or axis, only color, which on computers is red, green, blue, and alpha. You were defining the red value to tint it, the green value to tint it, the blue value to tint it, and the alpha value to tint it. Nothing with coordinates in there.

@SkyTheCoder - While you’re correct, I’m guessing he’s coming from a shader background where vectors are used to specify colors (and rgba is used interchangeably with wxyz, while they shouldn’t be).

I’m not saying that wxyz IS preferable - I’m just pedantically arguing that some may think it’s better… being a devil’s advocate. IMO rgba is the clearer way, but anyways this is incredibly off-topic considering i was just using it to show the arguments tint took

Also, I’d just like to mention, colours ARE vectors. A vector is just a one dimensional array, a set of scalars; a vector doesn’t imply coordinate axes. Positions along an axis are just one way to interpret a vector, some others being quaternions (which are 4d unit vectors) and of course, colours. For example, blending colours together additively is no different than adding vectors together: the maths is literally identical. So arguably, (w, x, y, z) is the more consistent route despite it not looking like a colour at first glance - but again, take into account the “arguably”. I don’t actually think (w, x, y, z) is the better way,