Gradually change color properties of a graphic

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
tamazaraptor
Posts: 12
Joined: Thu Feb 05, 2015 4:25 pm

Gradually change color properties of a graphic

Post by tamazaraptor » Fri Feb 06, 2015 6:29 pm

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! :)

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10100
Joined: Fri Feb 19, 2010 10:17 am

Re: Gradually change color properties of a graphic

Post by richmond62 » Fri Feb 06, 2015 7:31 pm

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 207 times
Last edited by richmond62 on Fri Feb 06, 2015 8:35 pm, edited 2 times in total.

magice
Posts: 457
Joined: Wed Mar 18, 2009 12:57 am

Re: Gradually change color properties of a graphic

Post by magice » Fri Feb 06, 2015 7:54 pm

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.

tamazaraptor
Posts: 12
Joined: Thu Feb 05, 2015 4:25 pm

Re: Gradually change color properties of a graphic

Post by tamazaraptor » Fri Feb 06, 2015 10:07 pm

Thank you very much magice and richmond62! These are both really useful resources for me :) Much appreciated! :D

Post Reply