472,122 Members | 1,560 Online

# Animations

75
Hi all,
Do any body know how to resize a control from its center in vb6?

Like if we do like this in a delayed loop:
Expand|Select|Wrap|Line Numbers
1. image1.width=image1.width+10
2. image1.height=imag1.height+10
It will resize the image to the right side not from the center..

The second is how to rotate some control on some angle like we can do with the lines..

Thanx
ARUZ
Mar 29 '09 #1
7 1509
debasisdas
8,127 Expert 4TB
1. you need to handle the left and right properties as well for resizing from center.
2. you need to use trigonometric functions SIN & COS for the rotation.
Mar 30 '09 #2
EYE4U
75
Do Sin and Cos functions can be applied on an image control?????

I dont think so?
Mar 30 '09 #3
vdraceil
236 100+
Try this....

'get center coordinates in x and y initially
y=image1.top+(image1.height/2)
x=image1.left+(mage1.width/2)
'change dimensions
image1.width=newwidth
image1.height=newheight
'set position so that center is same
image1.left=y-(image1.width/2)
image1.top=x-(inage1.height/2)
Mar 30 '09 #4
vdraceil
236 100+
i too dont think we can use SIN and COS for an image control..to rotate an image we have to extract every pixel color data..
Mar 30 '09 #5
EYE4U
75
Actually i m trying to make animation like Bounce. On mouse up it bounces up and again bounces down.

Mar 30 '09 #6
vdraceil
236 100+
For a ball bounce animation,you can just change the top property of the ball picture gradually in a timer...increase top property to make the ball move down and decrease it to make the ball move up.Do not change the left property of the picture.
You can also add elastic effect to the ball by reducing the height of the picture exactly at the moment when the ball reaches bottom position of bouncing.
Apr 1 '09 #7
EYE4U
75
If you have experienced rocket dock or object dock there is an zoom effect i want the exactly thing but with out smooth animation..

The anim you are saying is different...

Thanx
Apr 1 '09 #8