Scaling and unscaling a rectangle (not picture or OLE)

F

flying_pig

Is there a method or simple way of scaling up (say to 1.1) a simple rectangle
then returning it back to original size?

e.g. to animate a button where the built-in animation is not
suitable/unavailable.

If feel sure this is quite simple but am grateful for a steer.

Bob L
 
J

John Wilson

Apply an emphasis > grow shrink animation.
Set a custom zoom of 110% and press ENTER to confirm (make sure you press
enter or the default will come back)
Now double click the entry in custom animation and tick auto reverse. You
might want to trigger the animation with a click on itself.
 
F

flying_pig

John,

Unfortunately any attempt to use built-in animation effects are disabled as
all of the shapes are within groups. At this late stage I can neither afford
to ungroup them or turn them into pictures (although I would if starting from
scratch).

I tried to use Scaleheight / ScaleWidth but cannot set the unscale value
accurately enough and the shape either grows or shrinks following repeated
cycling (keypresses on the object that runs the scaling macro).

Any thoughts.
 
J

John Wilson

Based on Steve's code (which works in edit mode only) this would work only in
show mode (after youve used Steve's code to add the tags) and toggle between
pumped and whatever the opposite of pumped is! Give the shape an action
setting of run macro
'__ start
Sub PumpMeUpanddown(oshp As Shape)
With oshp
Select Case .Tags("height")
Case Is = CStr(.Height)
..Tags.Add Name:="Height", Value:=CStr(.Height)
..Tags.Add Name:="Width", Value:=CStr(.Width)
..Height = .Height * 1.1
..Width = .Width * 1.1
Case Is <> CStr(.Height)
..Height = CSng(.Tags("Height"))
..Width = CSng(.Tags("Width"))
End Sub
'__end
 
J

John Wilson

OOps missed a bit in the copy/paste!

Sub PumpMeUpanddown2(oshp As Shape)
With oshp
Select Case .Tags("height")
Case Is = CStr(.Height)
..Tags.Add Name:="Height", Value:=CStr(.Height)
..Tags.Add Name:="Width", Value:=CStr(.Width)
..Height = .Height * 1.1
..Width = .Width * 1.1
Case Is <> CStr(.Height)
..Height = CSng(.Tags("Height"))
..Width = CSng(.Tags("Width"))
End Select
End With
End Sub
 
F

flying_pig

John,

This worked ok and I can use it as is thanks. Always wanting a little more
I would have liked the scaling origin to be the middle of the shape but I
guess that is slightly more difficult?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top