Page 1 of 1
Stack fade-In
Posted: Wed Mar 18, 2009 9:01 pm
by keyless
I want to have a stack fade into view. I remember seeing or having a clip of code that used BlendLevel to fade the Stack into view smoothly. Can't seem to find now though.
I've experimented with a repeat down to 0, but my results haven't worked proper, or looked choppy.
Posted: Wed Mar 18, 2009 9:18 pm
by gyroscope
Hi keyless, the bit of code I was shown uses a repeat but there isn't any choppiness, and also its a fade out, so I guess fade in should be okay with the first line reversed. Plus you'll have to set your stack as transparent first, of course:
Code: Select all
on preOpenCard
Set the blendLevel of stack "Registration" to 100
end preOpenCard
on openCard
repeat with BlendOut = 100 to 0 step 2
set the blendlevel of stack "Registration" to BlendOut
wait 10 milliseconds
end repeat
end openCard
Hope that does the job for you (but if that's the code you had anyway, I expect there must be something else needed for a fade in...)

Posted: Wed Mar 18, 2009 10:17 pm
by keyless
First, Thanks for the script, it is similar to what I was trying, but more refined. The one I think I had before had some calculation for the wait, but I suspect this will be fine if I can get it to work.
everything about that script looks right, but when I put it in a stack, no fade in, I just see the card flash quick but nothings comes up. Blendlevel appears to stay at 100.
Posted: Wed Mar 18, 2009 11:52 pm
by gyroscope
That's mighty odd, I can't get a fade in to work either, even from a button press (and with a correction):
Code: Select all
repeat with BlendOut = 100 down to 0 step 2
Something missing here, I suppose but unfortunately I don't know what...
Posted: Thu Mar 19, 2009 12:58 am
by SparkOut
If it's an effect for a standalone, then this might work in the main stack script:
Code: Select all
on startup
set the visible of this stack to false
lock screen
set the blendLevel of this stack to 100
set the visible of this stack to true
unlock screen
send "blendIn 98" to this stack
end startup
on blendIn pBlendLevel
set the blendLevel of this stack to pBlendLevel
subtract 2 from pBlendLevel
if pBlendLevel >= 0 then
send "blendIn" && pBlendLevel to this stack in 15 milliseconds
end if
end blendIn
If you want to open a substack or another card, then you can "go invisible" card or stack and in the preOpenCard/preOpenStack handler kick off the blend level and invisibility before starting the blendIn handler. Doing it that way, even with the lock screen and setting of invisibility I can't avoid getting a quick flicker of the stack being displayed and then made invisible.
Posted: Thu Mar 19, 2009 3:43 am
by keyless
Thanks Sparkout, your script works great, fade in is nice and smooth.
Posted: Tue Mar 24, 2009 5:48 pm
by SparkOut
I found a way to make the preOpenStack method work without the flicker. (Doing it all in the preOpenStack makes it go a bit lala.) This works nicely here:
Code: Select all
on preOpenStack
set the visible of this stack to false
end preOpenStack
on openStack
set the blendLevel of this stack to 100
set the visible of this stack to true
send "blendIn 99" to this stack
end openStack
on blendIn pBlendLevel
set the blendLevel of this stack to pBlendLevel
subtract 1 from pBlendLevel
if pBlendLevel >= 0 then
send "blendIn" && pBlendLevel to this stack in 15 milliseconds
end if
end blendIn