Page 1 of 1

Gradually change color properties of a graphic

Posted: Fri Feb 06, 2015 6:29 pm
by tamazaraptor
Hi there,
I was wondering if anyone could give me some hints on how I could go about gradually (e.g. over 5 seconds) changing both the backgroundcolor and innerglow color of an object simultaneously? For instance, changing a graphic from red to blue. I have a feeling a repeat loop will do it, but wasn't sure how to combine the color properties (plus I am notoriously bad at repeat loops!).
Any help would be much appreciated! :)

Re: Gradually change color properties of a graphic

Posted: Fri Feb 06, 2015 7:31 pm
by richmond62
Maybe I'm being a bit stupid, but I just set up a stack with a square graphic, now when it
is transparent (i.e. NOT opaque) the innerGlow shows, and when it has a backGroundColor one cannot
see the innerGlow . . .

So what you are suggesting seems a bit pointless.

So, I am uploading a stack that mucks around with backGroundColor and outerGlow :)
effex.livecode.zip
(759 Bytes) Downloaded 208 times

Re: Gradually change color properties of a graphic

Posted: Fri Feb 06, 2015 7:54 pm
by magice
Something fun to play with :)
Make a button and put this script into it.

Code: Select all

local tRed
local tGreen
local tBlue
on mouseUp
   put 0 into tRed
   put 0 into tGreen
   put 255 into tBlue
   set the backgroundColor of me to (tRed&comma&tgreen&comma&tBlue)
send changeColor to me in 20 milliseconds
 end mouseUp
 on changeColor
    add 1 to tRed
    subtract 1 from tBlue
    set the backgroundColor of me to (tRed&comma&tgreen&comma&tBlue)
    if tBlue > 0 then send changeColor to me in 20 milliseconds
 end changeColor
You should be able to figure out how it works and how to make it fit your needs.

Re: Gradually change color properties of a graphic

Posted: Fri Feb 06, 2015 10:07 pm
by tamazaraptor
Thank you very much magice and richmond62! These are both really useful resources for me :) Much appreciated! :D