Page 1 of 1
Fade one object while moving others
Posted: Thu Oct 03, 2013 6:12 pm
by CenturyMan1979
Hey All,
I have 3 images on the screen,
A.) Image on the screen but invisible
B.) Image off the left side of the screen
C.) Image off the right side of the screen
Is there a method in where I can fade in "A" while "B" & "C" move into positions on the screen?
I am using lock moves on "B" & "C" so they will move at the same time. But I can't seem to figure out how to get "A" to do a fade at the same time.
Any help would be great.
Re: Fade one object while moving others
Posted: Thu Oct 03, 2013 6:31 pm
by Simon
Hi,
Checkout blendLevel in the dictionary.
In this case I expect a repeat loop is ok... But using "send" is usually better.
Simon
Re: Fade one object while moving others
Posted: Thu Oct 03, 2013 8:40 pm
by dunbarx
Hi.
Do you see what Simon meant? That in a repeat loop (or a "send" construct) you would map the blendLevel to the position of the "A" object as it moves from its start to its finish. If you know the number of steps it takes to get from those extreme points, you can scale the value of that property accordingly. This will take some experimentation to have the object appear at (visually) the right place and at the right level. Sounds like fun...
Craig Newman
Re: Fade one object while moving others
Posted: Thu Oct 03, 2013 8:58 pm
by CenturyMan1979
I figured that might be the answer but I was hoping I could just do something to the below code to make it work,
show image "A" with visual effect dissolve
But it seems visual effect and move do like playing nice together at the same time. It would be nice if they added a "without waiting" parameter to visual effect like they do with the move command.
Guess I will just have to make a fading behavior script I can attach to the image as they are being loaded during the run time.
Re: Fade one object while moving others
Posted: Thu Oct 03, 2013 10:33 pm
by dunbarx
You have that just right, I think, Certainly:
Code: Select all
show btn "A" with visual effect dissolve very slow
Does the effect just fine, as you already know, but there is no way to break up that effect into parts.
Code: Select all
show btn "A" with visual effect dissolve from 1 to 100 with messages
But it is straightforward to run the thing as discussed. You might say the blendLevel solution that Simon suggested is in fact an addressable and controllable dissolve effect. Harder to do with barn doors, for sure. You cannot have a native command for everything.
Craig
Re: Fade one object while moving others
Posted: Fri Oct 04, 2013 9:52 am
by Simon
hmm...
I wasn't thinking about the move command when I wrote the above. More about coordinating the effects.
If blendLevel and loc are used together in a repeat (send) then a nice sync could be done.
Simon
Re: Fade one object while moving others
Posted: Fri Oct 04, 2013 8:31 pm
by CenturyMan1979
So just modifying the blendLevel with a behavior script worked just like a charm. For those interested here is the behavior script I used,
Code: Select all
local sTransitionLength = 500 -- Length of transition in milliseconds
local sStartMS = 0 -- Holds the milliseconds when the transition starts
local sFPS = 24 -- Frames per second
local sSendDelay = 0 -- Length of time in milliseconds to repeat transition process method
# Run Transition
#=====================================================================
on runTransition
put the milliseconds into sStartMS
put trunc( (1000/sTransitionLength) * sFPS ) into sSendDelay
send "processTransition" to me in 1 milliseconds
end runTransition
# Process Transition
#=====================================================================
on processTransition
if sStartMS = 0 then exit processTransition
put the milliseconds into tCurrMS
put (tCurrMS - sStartMS) into tPassedMS
if ( tPassedMS >= sTransitionLength ) then
put 0 into sStartMS
set the blendLevel of me to 0
exit processTransition
else
put 100 - ((tPassedMS/sTransitionLength) * 100) into tNewBlendLevel
set the blendLevel of me to tNewBlendLevel
send "processTransition" to me in sSendDelay milliseconds
end if
end processTransition
Re: Fade one object while moving others
Posted: Fri Oct 04, 2013 10:05 pm
by dunbarx
Great.
I was playing with this when you first posted, and came up with the following for two buttons. This is in the script of btn 1, and it is not terribly universal:
Code: Select all
on mouseUp
set the right of btn 2 to "150"
set the blendlevel of btn 2 to 100
moveAndShow
end mouseUp
on moveAndShow
if the right of btn 2 = 250 then exit to top
set the right of btn 2 to the right of btn 2 + 1
set the blendlevel of btn 2 to 250 - the right of btn 2
send "moveAndShow" to me in 1
end moveAndShow
Craig