Segments: dxEffects

= Segments: DesktopX Effects=

Introduction to Scripting DesktopX Effects
Creating effects for dx objects using dxscript.

Demonstration Code: Zoom Effect
This was posted in the Wincustomize forums. Based on RomanDA's scripts. In effect what this does is moves and grows the object simultaneously giving the illusion of a zooming effect. Dim MinW,MaxW MinW = 48 MaxW = 256 MinH = 48 'This line is in here for future reference. Not functional in this script MaxH = 256 Sub Object_OnScriptEnter object.width = MinW Object.Height = MinH Object.top = 594 Object.left = 201 End Sub

'You can use place the script below into another object as follows 'Call DesktopX.ScriptObject("effect").Toggle Sub Object_OnLButtonDown(x,y) Call Toggle End Sub

' This Sub actually could be combined with the Grow/Shrink functions. ' It looks a little nicer this way. Sub Toggle If object.width => MinW Then Call Shrink Else Call Grow End If End Sub

Function Shrink object.KillTimer 200 object.SetTimer 100,10 End Function Function Grow object.KillTimer 100 object.SetTimer 200,10 End Function

Sub object_ontimer100 If object.width => MinW Then object.width = object.width - 4 object.height = object.height - 4 object.left = object.left - 8 object.top = object.top + 8 Else object.KillTimer 100 End If End Sub Sub object_ontimer200 If object.width <= MaxW Then object.width = object.width + 4 object.height = object.height + 4 object.left = object.left + 8 object.top = object.top - 8 Else object.KillTimer 200 End If End Sub

' Drop Files dynamically Sub Object_OnDropFiles(files) Object.picture = files End Sub

Comments/Suggestions
None right now. :-)