View Full Version : Need Help with Zoom in Actionscript
Zunskigraphics
05-01-2006, 04:22 PM
I am doing a site for a client. and I really want to use a zoom effect like the one here : www.enclavechicago.com ---> click skip intro ---> then click venue.
Im not interested in the way you move the photo with your cursor, but EXTREMELLY interested in how the zooming works when clicking on the different percentages.
Can anyone tell me if this is Actionscript, and if it is, tutorials, or advice in achieving this effect?
Thanks in advance!!
ZG
grass
05-01-2006, 06:56 PM
hey,
well if you just wanna zoom u should do it like this:
make sure the point in the picture, that it uses as _x and _y zero point, is in the center.
then just write smthng like this:
var targetwidth;
var targetheight;
var speed;
button onPress = function () {
targetwidth = something
};
interval = setInterval(move;33);
function move () {
if (object._width<targetwidth) {
object._width+= speed;
};
if (object._width>targetwidth) {
object._width-= speed;
};
};
however, if u want to make it accelerate, you should use smtng like this
in the interval:
if (Math.abs(object._width-targetwidth) > something) {
speed += something2;
};
if (Math.abs(object._width-targetwidth) < something) {
speed -= something2;
};
once i wrote somekind of movement like this... i needed copple of failsafe's to make it stop in the end but it worked...
i'm sure there's a better way but thisone works too :)
PS: i doublechecked the page - in this particular one it sets a quite fast speed onpress and then starts subtracting... there's also a maxspeed i quess...
there's another page, that uses samekind of movement.... but looks a bit better:
http://www.narko.ee/page.php?action=show_page&page_id=1
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.