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.

Vad_M
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!

sViz
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:

Code: vbscript
  1. Dim totalframes
  2. Dim animdir
  3. Dim animspeed
  4. totalframes = 19 '--total number of frames in your animation
  5. animspeed = 20 '--speed (ms) to play animation
  6. 'Called when the script is executed
  7. Sub Object_OnScriptEnter
  8.  object.CurrentFrame = 1'--number of frame that should show on start up
  9. End Sub
  10. 'Called on mouse over object and children
  11. Sub Object_OnMouseEnterEx(Obj)
  12.  object.KillTimer 1
  13.  animdir = "forward"
  14.  object.SetTimer 2,animspeed 
  15. End Sub
  16. 'Called on mouse awaay from object and children
  17. Sub Object_OnMouseLeaveEx(Obj)
  18.     object.SetTimer 1,100
  19. End Sub
  20. 'Timer delay
  21. Sub Object_OnTimer1
  22.   animdir = "back"
  23.  object.SetTimer 2,animspeed 
  24.  object.KillTimer 1
  25. End Sub
  26. 'Play Animation
  27. Sub Object_OnTimer2
  28.  Select Case animdir
  29.   Case "forward"
  30.    If object.CurrentFrame < totalframes Then object.CurrentFrame = object.CurrentFrame + 1 Else object.KillTimer 2
  31.   Case "back"
  32.    If object.CurrentFrame > 1 Then object.CurrentFrame = object.CurrentFrame - 1 Else object.KillTimer 2
  33.  End Select
  34. End Sub
  35. 'Called when L-click on object or its children
  36. Function Object_OnLButtonUpEx(obj, x, y, dragged)
  37.  If dragged Then Exit Function
  38.  Select Case obj.name
  39.   'List your clickable child objects here
  40.   Case "rectangle1", "rectangle2", "rectangle3"
  41.    animdir = "back"
  42.    object.SetTimer 2,animspeed
  43.  End Select
  44. 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.

sViz
Reply #3 Monday, May 25, 2009 6:16 AM

Ah, ya beat me to it, Vad!

Vad_M
Reply #4 Monday, May 25, 2009 7:19 PM

 +   +   =

 

vStyler
Reply #5 Monday, May 25, 2009 8:15 PM

Also... please dont post in caps... thx

mitafax
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.

mitafax
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!



web-wc01