Fading Script

Thursday, July 3, 2008 by PoSmedley | Discussion: DesktopX Tutorials

I need a script that will do the following...
 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.




BigDogBigFeet
Reply #1 Friday, July 4, 2008 2:40 AM
This is doable Po'. I don't think it requires a timer though you could just use a for loop. Not sure of the exact VB syntax but it would look like this:

'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.
Vad_M
Reply #2 Friday, July 4, 2008 11:28 AM
I have a bit modified the sVis code...   

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?
PoSmedley
Reply #3 Friday, July 4, 2008 11:58 AM
I have a bit modified the sVis code.


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!
BigDogBigFeet
Reply #4 Friday, July 4, 2008 12:30 PM
To adjust the speed try changing this line "Object.SetTimer 1,10" to "Object.SetTimer 1,100" or, if still too fast try "Object.SetTimer 1,1000".

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.
PoSmedley
Reply #5 Friday, July 4, 2008 12:48 PM
To adjust the speed try changing this line "Object.SetTimer 1,10" to "Object.SetTimer 1,100" or, if still too fast try "Object.SetTimer 1,1000".

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.
Vad_M
Reply #6 Friday, July 4, 2008 12:59 PM
To adjust the speed try changing this line "Object.SetTimer 1,10" to "Object.SetTimer 1,100" or, if still too fast try "Object.SetTimer 1,1000".

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

Can I make the Object Controller fade out as the array fades in?


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.

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
SirSmiley
Reply #7 Friday, July 4, 2008 2:41 PM
I did a simple one last night but, Box.net wasn't playing nicely.
Here it is for anyone who wants it.

http://www.box.net/shared/g5p2z33swk
Mighty Maid
Reply #8 Friday, July 4, 2008 6:27 PM
Too technical for me. Glad someone was able to help you.
PoSmedley
Reply #9 Saturday, July 5, 2008 9:24 AM
First off, let me say, I truly appreciate the help on this.

Vad_M, in the last script you posted...
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!!!!


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.



Vad_M
Reply #10 Saturday, July 5, 2008 11:17 AM
Change them to what?


To any numbers that you want.Bby this way you can change the speed of fading.

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.


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.   
theAVMAN
Reply #11 Saturday, July 5, 2008 11:21 AM
Po What have you got up your sleeve?
PoSmedley
Reply #12 Saturday, July 5, 2008 12:22 PM
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.


I'll email it.
PoSmedley
Reply #13 Saturday, July 5, 2008 12:38 PM
Po What have you got up your sleeve?


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!



web-wc01