Random Musings from the Intellectually Gifted. How's that for no ego? :pfft
Published on September 11, 2006 By SirSmiley In DesktopX
If you look closely you'll notice this is a minor variation of one of Roman's tutorials. Will obviously need some tweaking based on your settings. I tested it with a simple 1px white tile. It grows & moves at the same time giving a zoom appearance.

Had one effect actually arcing like it was popping out. Lost it in a dx crash unfortunately.

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

Sub Object_OnDropFiles(files)
Object.picture = files
End Sub
Comments
on Sep 13, 2006
Nice, very nice!   

Thanks for sharing that cool effect.

You see, this is what I'm talking about. We need a board specially for tips and tricks.
on Sep 13, 2006
http://scratchpad.wikia.com/wiki/DesktopX

A link from WC to here would be nice even.
on Sep 13, 2006
A link from WC to here would be nice even.


I concur.

SirSmiley you should check out the wiki Zubaz linked. This would be a great addition.
on Sep 15, 2006
I checked that out & joined the last time someone mentioned. Whether I'm too lazy (most likely) or too busy I meant to post a bunch of scripts there.

Many aren't commented well and I want to make things simpler for those who are just starting out. Noticed that most have a tutorial type of format & my submittals may be more of a "script repository" type of post.
on Sep 15, 2006
Many aren't commented well and I want to make things simpler for those who are just starting out. Noticed that most have a tutorial type of format & my submittals may be more of a "script repository" type of post.


It's a wiki . .maybe someone else will improve on them.

I need all the help I can get.
on Sep 15, 2006
Ok. Thanks for the quick response.

I need all the help I can get.


You're still meaning the wiki?

on Oct 29, 2006
*bump*

Working on a project I've streamlined this & achieved a smoother animation... for me at least!

Works nice on a round object.

Dim MinW,MaxW,MinH,MaxH,PosX,PosY
MinW = 26 'Changed from 16 to 26 because of timer script
MaxW = 132
MinH = 26
MaxH = 132
PosX = 500 'Position right from left edge
PosY = 200 'Position down from top edge

'Positions & sizes object on start
Sub Object_OnScriptEnter
Object.Left = PosX
Object.Top = PosY
Object.width = MaxW
Object.Height = MaxH
End Sub

'This controls the animation
'Streamlined the script from multiple subs/functions

Sub Object_OnLButtonUp(x,y,
If Object.width => MinW Then
Object.KillTimer 200
Object.SetTimer 100,25
Else
Object.KillTimer 100
Object.SetTimer 200,25
End If
End Sub

'This shrinks it
Sub Object_ontimer100
If Object.width => MinW Then
Object.Width = Object.Width - 10
Object.Left = Object.Left + 5
Object.Height = Object.Height - 10
Object.Top = Object.Top + 5
Else
Object.KillTimer 100
End If
End Sub
'This grows it
Sub Object_ontimer200
If Object.width <= MaxW Then
Object.Width = Object.Width + 10
Object.Left = Object.Left - 5
Object.Height = Object.Height + 10
Object.Top = Object.Top - 5
Else
Object.KillTimer 200
End If
End Sub