Fading Script
Thursday, July 3, 2008 by PoSmedley | Discussion: DesktopX Tutorials
On 'mouse up' have the obect/group fade out
and
another object/group fade in
if it's possible.
I'd like it to be able to work in reverse as well.
if that's possible as well.
I checked this tutorial http://wiki.wincustomize.com/wiki/DesktopX:_Scripting_Visibility_(Beginner)#Fading but it is for one object to constantly fade in and out. I can't figure how to alter it.
I want to have the top tabs fade out and the icons fade in...then in reverse when I close the icons. Right now, I have it so it just shows and hides, but I think the fading would be cooler.

Any help would be appreciate.
Thanks.
Reply #2 Friday, July 4, 2008 11:28 AM
Dim objects,fade
Sub Object_OnScriptEnter
'enter here the names of objects that you need
objects = Array("name1","name2","name3",.....)
fade = "in"
End Sub
Sub Object_OnStateChange(state)
If state = "Command executed" Then
If fade = "in" Then fade = "out" Else fade = "in"
Object.SetTimer 1,10
End IF
End Sub
Sub Object_OnTimer1
Select Case fade
Case "out"
If desktopx.object("name1").opacity > 0 Then
For Each item In objects
desktopx.object(item).opacity = desktopx.object(item).opacity - 1
Next
Else
Object.KillTimer 1
For Each item In objects
desktopx.object(item).opacity = 0
Next
End If
Case "in"
If desktopx.object("name1").opacity < 100 Then
For Each item In objects
desktopx.object(item).opacity = desktopx.object(item).opacity + 1
Next
Else
Object.KillTimer 1
For Each item In objects
desktopx.object(item).opacity = 100
Next
End If
End Select
End Sub
May be this will help you?
Reply #3 Friday, July 4, 2008 11:58 AM
Okay. It works!!!!!!!!!!!!!!!
How do I adjust the speed?
and
Can I make the Object Controller fade out as the array fades in?
THANK YOU SO MUCH!
Reply #4 Friday, July 4, 2008 12:30 PM
To get the array to fade in you would need a second array of objects and add a line in the for loop to fade it in.
So, objects2 = Array("name1","name2","name3",.....) added in first sub and add these lines
For Each item In objects2
desktopx.object(item).opacity = desktopx.object(item).opacity + 1
next
added just below the for loop in the second sub.
You may need some other adjustments depending on how you want the second group to behave.
Reply #5 Friday, July 4, 2008 12:48 PM
To get the array to fade in you would need a second array of objects and add a line in the for loop to fade it in.
So, objects2 = Array("name1","name2","name3",.....) added in first sub and add these lines
For Each item In objects2
desktopx.object(item).opacity = desktopx.object(item).opacity + 1
next
added just below the for loop in the second sub.
You may need some other adjustments depending on how you want the second group to behave.
I'm dizzy. lol
I want to click on an object in GROUP01
have GROUP02 fade in
and GROUP01 bfade out or just go away
then
I want to be able to click on an object in GROUP02
have GROUP01 fade in
and GROUP02 fade out or just go away
Both groups are occupying the same bar...(see image at top) so they can't be seen simultaneously.
Reply #6 Friday, July 4, 2008 12:59 PM
That's right. As well you may do this by changing the step of opacity increasing/reduction:
desktopx.object(item).opacity = desktopx.object(item).opacity - 25
desktopx.object(item).opacity = desktopx.object(item).opacity - 10
Yes, you really need the second array:
Dim objects1,objects2,fade
Sub Object_OnScriptEnter
'enter here the names of objects that you need
objects1 = Array("name1","name2","name3",.....)
objects2 = Array("name1","name2","name3",.....)
fade = "in"
End Sub
Sub Object_OnStateChange(state)
If state = "Command executed" Then
If fade = "in" Then fade = "out" Else fade = "in"
Object.SetTimer 1,10 '<== change this value as you want
End IF
End Sub
Sub Object_OnTimer1
Select Case fade
Case "out"
If desktopx.object("name1").opacity > 0 Then
For Each item In objects1
desktopx.object(item).opacity = desktopx.object(item).opacity - 1 '<== change this....
Next
For Each item In objects2
desktopx.object(item).opacity = desktopx.object(item).opacity + 1 '<== and this!!!!!...
Next 'the steps must be equal!!!!
Else
Object.KillTimer 1
For Each item In objects1
desktopx.object(item).opacity = 0
Next
For Each item In objects2
desktopx.object(item).opacity = 100
Next
End If
Case "in"
If desktopx.object("name1").opacity < 100 Then
For Each item In objects1
desktopx.object(item).opacity = desktopx.object(item).opacity + 1
Next
For Each item In objects2
desktopx.object(item).opacity = desktopx.object(item).opacity - 1
Next
Else
Object.KillTimer 1
For Each item In objects1
desktopx.object(item).opacity = 100
Next
For Each item In objects1
desktopx.object(item).opacity = 0
Next
End If
End Select
End Sub
Reply #7 Friday, July 4, 2008 2:41 PM
Here it is for anyone who wants it.
http://www.box.net/shared/g5p2z33swk
Reply #8 Friday, July 4, 2008 6:27 PM
Reply #9 Saturday, July 5, 2008 9:24 AM
Vad_M, in the last script you posted...
Select Case fade
Case "out"
If desktopx.object("name1").opacity > 0 Then
For Each item In objects1
desktopx.object(item).opacity = desktopx.object(item).opacity - 1 '<== change this....
Next
For Each item In objects2
desktopx.object(item).opacity = desktopx.object(item).opacity + 1 '<== and this!!!!!...
Next 'the steps must be equal!!!!
Change them to what?
and..do I need to put this script in the object controller's of both array's?
I inserted it and the first group fades out as the second fades in, then the first fades back in and the second vanishes. I tried putting the script in the object controller in both array's, but it still does the same thing, even when I tried reversing the code/array's in the second group. I assume it has something to do with what you are telling me to change in the above quote.
Reply #10 Saturday, July 5, 2008 11:17 AM
To any numbers that you want.Bby this way you can change the speed of fading.
Here is that I think about this right now. Let's stop the spending of our time! Please send me your *.dxpack file here: e-mail with a few lines of information about how it must work. I'll make a code that you need very quickly in this case (seems in a 10-15 minutes) and will send it to you.
Reply #12 Saturday, July 5, 2008 12:22 PM
I'll email it.
Reply #13 Saturday, July 5, 2008 12:38 PM
I'm working on a DXTheme based on DooM. I'm trying to create a desktop interface that might simulate something on the Olduvia Research Station.
Please login to comment and/or vote for this skin.
Welcome Guest! Please take the time to register with us.
There are many great features available to you once you register, including:
- Richer content, access to many features that are disabled for guests like commenting on the forums and downloading skins.
- Access to a great community, with a massive database of many, many areas of interest.
- Access to contests & subscription offers like exclusive emails.
- It's simple, and FREE!







Reply #1 Friday, July 4, 2008 2:40 AM
'Fading Out
For I = 1 to 100
mygroup.opacity = mygroup.opacity - 1
loop
'Fading In
For I = 1 to 100
mygroup.opacity = mygroup.opacity + 1
loop
To get the fading in and fading out to apply to a group, just give your group a group name as I've tried to indicate.