PLEASE HELP WITH ANIMATION DESKTOPX...
want to do this with anim png. No clue as to how ?????
Monday, May 25, 2009 by mitafax | Discussion: Object Desktop
I can't find this anywhere in the forums... I want to create a folder using anim/png that with a click will extend then stay extended until a page from the folder is clicked on ( my computer, another app. etc ) then allow the folder to collapse. (png strip backwards) I have tried making invisible rectangles over each page but as soon as i mouse over the rect the anim closes before it can be clicked on. The timer script i saw doesn't work even if the objects are reasonably close together. Someone please see if you can offer any ideas. Here is my example.
http://mitafax.deviantart.com/art/DesktopX-animation-4-menu-122706503
thank you
mitafax.
Reply #2 Monday, May 25, 2009 6:16 AM
Sounds like you're on the right track with using rectangles (masks) for the pages. If you're talking about THIS timer for mouse over/away issues, it won't keep the parent object from playing the mouse away animation unless the animation is scripted.
I'd recommend scripting the animation, instead of using the presets in the animation tab. HERE is a tutorial by RomanDA which explains how that works.
Without knowing your actual setup, I'm gonna hafta take a stab in the dark on the script.
First, make sure your rectangles are all children of the animation object (go to Properties > Summary and make sure child = yes. )
Next, set the animation tab as instructed in the tutorial above (set frames and check 'Scripted'. You won't be needing more than one state, BTW, so get rid of any extras.)
Okay, here comes the script. I've combined the mouse away/over script with one for scripted animation on timer (see the links above) This should go in the ANIMATION object:
- Dim totalframes
- Dim animdir
- Dim animspeed
- totalframes = 19 '--total number of frames in your animation
- animspeed = 20 '--speed (ms) to play animation
- 'Called when the script is executed
- Sub Object_OnScriptEnter
- object.CurrentFrame = 1'--number of frame that should show on start up
- End Sub
- 'Called on mouse over object and children
- Sub Object_OnMouseEnterEx(Obj)
- object.KillTimer 1
- animdir = "forward"
- object.SetTimer 2,animspeed
- End Sub
- 'Called on mouse awaay from object and children
- Sub Object_OnMouseLeaveEx(Obj)
- object.SetTimer 1,100
- End Sub
- 'Timer delay
- Sub Object_OnTimer1
- animdir = "back"
- object.SetTimer 2,animspeed
- object.KillTimer 1
- End Sub
- 'Play Animation
- Sub Object_OnTimer2
- Select Case animdir
- Case "forward"
- If object.CurrentFrame < totalframes Then object.CurrentFrame = object.CurrentFrame + 1 Else object.KillTimer 2
- Case "back"
- If object.CurrentFrame > 1 Then object.CurrentFrame = object.CurrentFrame - 1 Else object.KillTimer 2
- End Select
- End Sub
- 'Called when L-click on object or its children
- Function Object_OnLButtonUpEx(obj, x, y, dragged)
- If dragged Then Exit Function
- Select Case obj.name
- 'List your clickable child objects here
- Case "rectangle1", "rectangle2", "rectangle3"
- animdir = "back"
- object.SetTimer 2,animspeed
- End Select
- End Function
Major points:
-OnScriptEnter, set the current frame to the one you want showing when the object is at rest.
-OnLButtonUpEx will play the animation backwards when you click on any of your rectangles. Just list the names of each of your rectangles as seen in the code.
-Adjust the 'totalframes' and 'animspeed' variables at the top as needed.
I put together an example dxpack HERE .
Hope this helps...someone. ![]()
Reply #6 Monday, May 25, 2009 10:10 PM
Thank you both very much !!! i'm thinking that vb script sViz listed is exactly the thing !
i'll letcha know.
THANKS.
Reply #7 Tuesday, May 26, 2009 10:58 PM
IT WORKS !!! Thank you guys. I'm ironing out the bugs right now !
THanx again.
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 Monday, May 25, 2009 6:04 AM
First af all you may look here - Animation (tab): https://www.stardock.com/products/desktopx/help/dev_guide_2objects.htm
You hardly find the exhaustive answer for your question. However this tutorial will give you the base information about DX animation.
But I think that you may use the other way. Please look below:
1. Create a "folder" button which should have two states "expanded" and "collapsed" (animation is not required!).
2. Copy and pase this simple code into your button.
Dim isopened : isopened = False
Sub Object_OnStateChange(state)
Select Case state
Case "Command executed"
isopened = IFE(isopened, False, True)
If isopened Then
'RUN SOME CODE HERE..... (or do nothing if you open a folder through DesktopX)
End If
Case "Mouse up"
object.state = IFE(isopened, "expanded", "collapsed")
End Select
End Sub
Function IFE(ex,v1,v2) '<== This function do the same that "IFF" SQL and "IIF" VB built-in functions
IFE = v2
If ex Then IFE = v1
End Function
3. That's all. Have a nice day with DesktopX!