I have a code that put a graphic effect (drop shadow) to a field and scroll the opacity (of drop shadow), to 30 at 255 and 255 at 30.
I have 2 cards, card1 and card2. So i factorize the code in my main stack
In my main stack
Code: Select all
global appField # the field i want to put the graphic effect
global fin # When i close a card, stop the animationMenu
Command animationMenu
if fin is false then
opacitéCroissante
end if
end animationMenu
command opacitéCroissante # grow the opacity
if fin is false then
if (the dropShadow["opacity"] field appField < 255) then
put the dropShadow["opacity"] field appField
set the dropShadow["opacity"] field appField to (the dropShadow["opacity"] field appField +10)
send "opacitéCroissante" to me in 50 milliseconds
else
opacitéDécroissante
end if
end if
end opacitéCroissante
command opacitéDécroissante # reduction of the opacity
if fin is false then
if the dropShadow["opacity"] field appField > 30 then
put the dropShadow["opacity"] field appField
set the dropShadow["opacity"] field appField to (the dropShadow["opacity"] field appField - 5)
send "opacitéDécroissante" to me in 50 milliseconds
else
animationMenu
end if
end if
end opacitéDécroissante
Code: Select all
on preOpenCard
put "field3" into appField
set the dropShadow["color"] of field appField to "255,255,0"
set the dropShadow["opacity"] field appField to 30
put false into fin
animationMenu
end preOpenCard
...
go to card2
Code: Select all
on preOpenCard
put "field1" into appField
set the dropShadow["color"] of field appField to "red"
set the dropShadow["opacity"] field appField to 30
put false into fin
animationMenu
end preOpenCard
on CloseCard
put true into fin
end CloseCard
...
go to card1