Hi guys
Just wondering whether there is a way to tint a sprite to a certain colour by using the tween library (transition.to).
If not, how would I go about doing this?
Thank you in advance!
Hi guys
Just wondering whether there is a way to tint a sprite to a certain colour by using the tween library (transition.to).
If not, how would I go about doing this?
Thank you in advance!
Hi Guys
I just though I’d bump this topic since there haven’t been any replies in a few days.
Also, I’ll elaborate a little on what I mean
I know how to tint a graphic, but was wondering if there is any inbuilt/quick method of smoothly animating the tint or if I have to use some form of onEnterFrame method and do it by hand?
Thank you in advance!
Hey,
I subscribed to this post hoping for a decent solution to be posted because I, too, would very much like to know how this can be done I guess that it can’t be done “out of the box” using tweening as there doesn’t appear to be a property that can be set for the colour over time. But, if you store the specific RGB values as separate variables, then using a timer or a loop you should be able to change these values and (by incrementing by 1 or 2 or whatever you want) and then set as the image colour to the object. This should, in theory, change it’s colour over a given time. e.g.:
– this will make the object transition from black to white
for i=0, 255 do – I’m still using graphics 1.0, whoops…
obj.colorTimer = timer.performWithDelay( 10, function() obj:setFillColor( i,i,i ); end ) – will fire off colour change every 10ms
end
As you mentioned, enterFrame is also another way but at least if you use something like the above then you can put it into a function and fire it off whenever you need to. I am sure that there are much better ways to do this than what I have done above so I’ll have a think… I am at work at the moment so I can’t test this but I will probably take a look at this in the next few days so will give you a shout if I am able to do it properly
Rich
Hi guys,
The enterFrame method is acceptable, but you might also achieve the effect you need by transitioning a “monotone” filter on the image via a transition:
http://docs.coronalabs.com/guide/graphics/effects.html#filter.monotone
There’s an example at the top of the “Filter Effects” section which shows how to use these in a transition… remember what you’re transitioning: it’s not the object itself, not the fill itself, not even the fill effect, but rather the property (or properties) of the fill effect.
Best regards,
Brent
Cheers Brent I’m still yet to transition to new Graphics library, mainly because I know that I’ll be adding all the bells and whistles before I finish off the core stuff will definitely will definitely do it soon though then make use of these filters
Rich
Thank you for the solutions guys!
Hi Guys
I just though I’d bump this topic since there haven’t been any replies in a few days.
Also, I’ll elaborate a little on what I mean
I know how to tint a graphic, but was wondering if there is any inbuilt/quick method of smoothly animating the tint or if I have to use some form of onEnterFrame method and do it by hand?
Thank you in advance!
Hey,
I subscribed to this post hoping for a decent solution to be posted because I, too, would very much like to know how this can be done I guess that it can’t be done “out of the box” using tweening as there doesn’t appear to be a property that can be set for the colour over time. But, if you store the specific RGB values as separate variables, then using a timer or a loop you should be able to change these values and (by incrementing by 1 or 2 or whatever you want) and then set as the image colour to the object. This should, in theory, change it’s colour over a given time. e.g.:
– this will make the object transition from black to white
for i=0, 255 do – I’m still using graphics 1.0, whoops…
obj.colorTimer = timer.performWithDelay( 10, function() obj:setFillColor( i,i,i ); end ) – will fire off colour change every 10ms
end
As you mentioned, enterFrame is also another way but at least if you use something like the above then you can put it into a function and fire it off whenever you need to. I am sure that there are much better ways to do this than what I have done above so I’ll have a think… I am at work at the moment so I can’t test this but I will probably take a look at this in the next few days so will give you a shout if I am able to do it properly
Rich
Hi guys,
The enterFrame method is acceptable, but you might also achieve the effect you need by transitioning a “monotone” filter on the image via a transition:
http://docs.coronalabs.com/guide/graphics/effects.html#filter.monotone
There’s an example at the top of the “Filter Effects” section which shows how to use these in a transition… remember what you’re transitioning: it’s not the object itself, not the fill itself, not even the fill effect, but rather the property (or properties) of the fill effect.
Best regards,
Brent
Cheers Brent I’m still yet to transition to new Graphics library, mainly because I know that I’ll be adding all the bells and whistles before I finish off the core stuff will definitely will definitely do it soon though then make use of these filters
Rich
Thank you for the solutions guys!