Hi Guys
I'm trying to figure out how to tint a sprites colour using Gtween. On the forums, I found the code below, but when I try it it doesn't seem to do anything.
Any ideas on what I'm doing wrong?
Also, is there a way to do this using Gideros Movieclips?
Thank you in advance!
**********
local sprite = Bitmap.new(Texture.new("box.png"))
stage:addChild(sprite)
GTween.new(sprite, 5, {redMultiplier=255, greenMultiplier=0, blueMultiplier=0})
Comments
Are you sure that you add gtween.lua to your project?
if redMultiplier = 255 it transitions to red
if greenMultiplier = 255 it transitions to green
if blueMultiplier = 255 it transitions to black
Why black? What is happening there?
Actually, the 1 pixel or so black border around the image goes blue and all the yellow colours inside the border go black.
If all 3 multipliers are 0 then the entire image goes black(border included)
Then see a slight difference between blue=255 and all as 0.
local sprite = Bitmap.new(Texture.new("images/Rook_yellow.png"))
stage:addChild(sprite)
GTween.new(sprite, 5, {redMultiplier=255, greenMultiplier=0, blueMultiplier=0})
local sprite1 = Bitmap.new(Texture.new("images/Rook_yellow.png"))
stage:addChild(sprite1)
sprite1:setX(100)
sprite1:setY(100)
GTween.new(sprite1, 5, {redMultiplier=0, greenMultiplier=255, blueMultiplier=0})
local sprite2 = Bitmap.new(Texture.new("images/Rook_yellow.png"))
sprite2:setX(200)
sprite2:setY(200)
stage:addChild(sprite2)
GTween.new(sprite2, 5, {redMultiplier=0, greenMultiplier=0, blueMultiplier=255})
// also 0,0,0
Thank you all for you help, I've just tried it again in a new test (this time on a movieclip) and it works perfectly
Now the only problem I have is that, I can't seem to tint the movieclip to white.
I want to "flash" the movieclip to white quickly and then fade back to normal.
Any ideas?
Thank you in advance!
Possible workaround hence 255,255,255 is not working.
Add one more totaly white image to stage with alpha = 0.
Then gtween it is alpha on top of all images to 1 quicly and back to 0 again then remove it from stage
Do you guys have any other ideas on how to tint a movie clip to a completely white colour using a tween?
http://www.giderosmobile.com/forum/discussion/980/tween-anything
as folks replied, then yes it is possible, but only using color multipliers
and currently there is a limitation, which clips the provided values to 1
So for example, you have a #666666 color, in red channel you have 66, so you want it to drop down to 33, you provide multiplier 0.5 (as in 33/66 = 0.5)
But what if you want to make it to white color?, you would actually want to increase the value with 2.5 multiplier (as in FF/66 = 2.5), but in open GL 1.0 you have a limitation that the maximum value is 1. So you could never reach a color higher than 66 in red channel.
But it has been fixed in developer preview which uses OpenGL 2 and thus will be fixed in Gideros 2.0
And for now, if you want to fully change the colors of the image to any other color, you would need to take channels with maximum possible values as (#FFFFFF) or basically using white image
Hope that helps
Thank you for the detailed answer, I really appreciate it! Looking forward to trying Gideros 2
@ar2rsawseen, I understand what you've detailed above, but I still can't seem to figure out a simple way of doing this
Does anybody possibly have an example/workaround I could have a look at?
Thank you again for your help?