Resizing png file
Need a little help!!!
Friday, June 13, 2008 by Automan | Discussion: DesktopX Tutorials
Hi folks;
I have a menu system built into my DesktopX theme, and I need a little scripting help?
I am building in Photoshopcs3 all of the png files for certain links and task like Utilities, Media,Office,etc.
Now I make the images at 64 pixels an I am trying to use cod to make the images change size to 72 pixels with " Mouse over".
I need a way to increase the size just like Object dock plus. Increase the size with code so the it will enlarge the image to jump out to the 72 pixels.
Can someone help me on this, I need it to move smoothly to the larger size.
Thanks folks!!!
Automan
Reply #2 Friday, June 13, 2008 4:04 PM
Sub Object_OnMouseEnter
Object.Resize 72,72
End Sub
'Called when mouse leaves object
Sub Object_OnMouseLeave
Object.Resize 64,64
End Sub
Didnt work for me.
Reply #4 Friday, June 13, 2008 4:33 PM
Reply #8 Friday, June 13, 2008 8:17 PM
Looks like we are kind of missing the idea here, as when you use the code here which I have used to resize before; it will move the png image larger and down to the bottom left by a little bit. This would also need to have a - off set to make the image just grow larger.
The one thing I am trying to do is set the image to spring out larger just like Object dock plus.
Object dock moves the image at a smooth pace to the larger size instead of just jumping to the resize, thus forth there has to be away to get the alignment right and also get the smooth slowe spring up action.
Any ideas using a little math maybe?
Thanks for all the help here, if this can be done, then any part of an object on the desktop can be set by vbcode to move in the same fasion.
Thanks again for the brain work. It's really appreciated!
Automan
Reply #9 Friday, June 13, 2008 8:31 PM
- Dim MinW,MaxW
- MinW = 64
- MaxW = 128
- MinH = 64
- MaxH = 72
- Sub Object_OnScriptEnter
- object.width = MinW
- Object.Height = MinH
- End Sub
- 'Called on mouse over object
- Sub Object_OnMouseEnter
- Call Grow
- End Sub
- 'Called when mouse leaves object
- Sub Object_OnMouseLeave
- Call Shrink
- 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 + 2
- Object.Top = Object.Top + 2
- 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 - 2
- Object.Top = Object.Top - 2
- Else
- object.KillTimer 200
- End If
- End Sub
Reply #11 Friday, June 13, 2008 8:50 PM
- Dim MinW,MaxW
- MinW = 64
- MaxW = 128
- MinH = 64
- MaxH = 72
- Sub Object_OnScriptEnter
- object.width = MinW
- Object.Height = MinH
- End Sub
- 'Called on mouse over object
- Sub Object_OnMouseEnter
- Call Grow
- End Sub
- 'Called when mouse leaves object
- Sub Object_OnMouseLeave
- Call Shrink
- 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 Or object.Height=> MinH Then
- object.Resize object.Width-4,object.Height-4
- object.Move object.Left+2,object.Top+2
- Else
- object.KillTimer 100
- End If
- End Sub
- Sub object_ontimer200
- If object.Width<=MaxW Or object.Height<=MaxH Then
- object.Resize object.Width+4,object.Height+4
- object.Move object.Left-2,object.Top-2
- Else
- object.KillTimer 200
- End If
- End Sub
Reply #12 Saturday, July 26, 2008 6:13 PM
lol
Reply #14 Tuesday, September 2, 2008 7:28 AM
Great job on the code here, I have it working, but a always when you think youn have it perfect you find a change that would make it even better. So here goes.
Most of us have seen the new Impulse Ver.2 and it is slick! My only problem is that I don't want it running in memory all the time. So I turned and looked at my Menu system and presto it hit me.
In the new impulse there is a mouse over event that uses a black bar that when presed it will change to orange. This being said, I decided to mae my menu just like impulse but with out all the goodies thatn it has. Below is a list of what I am trying to do.
1 DesktopX pops open the menu.
2 When your mouse passes over the text name of the object it wii show the "Black Image".
Also I need a call to png "Icon image to make it use the code that was made before on the icon image to grow to the max height or on leave shrink back down to the correct state, This where I get into trouble..How do you call the resize code that is in the Icon to make it 92 as if the mouse was over it and the shrink it back down when the mouse leaves the text and bar
I will post an image of what I'm trying to do in a few minutes.
Anyway if you have seen the new Impulse and move your mouse over the menu like " My Desktop"
The change is rally cool!!!!
DesktopX PopUp
Mouse over = Black then
om Mouse pause over the Icon and the bar will switch to a gold/orange bar and text stays the same color unless you want it to...On click program startsm
I hope all of this has made a little sense, sounds cool anyway.........
Thanks a million guys and gals......
Automn
Automan
Reply #15 Tuesday, September 2, 2008 11:12 AM
Have you considered using animation strips instead of script? They might work better for this.
Reply #16 Tuesday, September 2, 2008 8:25 PM
There are always a bunch of ways to do things in DX
Animation strips can work good, so can a timer, its more CPU intensive. In the strip you can control how long things take, and also when to start stop or REVERSE the animation. Im sure i have a tutorial on this somewhere out there if you need one.
Reply #17 Thursday, September 4, 2008 6:10 AM
It is also much more time consuming
Plus you lose the dock items' customizability.
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 Friday, June 13, 2008 3:00 PM