I've been looking into a similar problem.... I have a mc that I need to smoohtly zoom in and out of and after days (kid you not, I spent like 2 weeks on this now) of searching I came across tweenmax.... even so I couldn't for the life of me figure it out, but the latest code posted by greensock cleared some stuff up.
I tweaked it to make it work for my purposes, it's in AS2 + my coding skills aren't great so I expect it contains some duplicate and redundant statements, but it works!
this is an extract from my original project, just has the zoom in/out functionality.
you will need a mc and 2 buttons on stage.
main code:
import com.greensock.TweenMax;
import com.greensock.easing.*;
FastEase.activate([Linear, Quad, Strong]); //not sure if this helps with the default tween?
//any comments on fastEase would be appreciated:)
_global.base=this;
var isMouseDown:Boolean = false;
var speed:Number = 1.1;
var maxScale:Number = 100; //maximum scaleX allowed
var minScale:Number = 25; //minimum scaleX allowed
// this is because I'm inserting a bitmap that starts off displayed at 25%
mc._xscale=mc._yscale=25;
var duration:Number = 0;
var CurrentScale:Number = mc._xscale;
var newScale:Number=0;
this.onMouseDown = function() { isMouseDown = true; }
this.onMouseUp = function() { isMouseDown = false; }
////////////////////////////////////////////////////////////////////////////
//TWEENS
tweenzoomin=function(){
TweenMax.to(mc, duration, {_xscale:maxScale, _yscale:maxScale, useFrames:true});
} //no easing defined - found that default works best..
tweenzoomout=function(){
TweenMax.to(mc, duration, {_xscale:minScale, _yscale:minScale, useFrames:true});
}//no easing defined - found that default works best..
zoomease=function(){
TweenMax.to(mc, duration, {_xscale:newScale, _yscale:newScale, ease:Quad.easeOut, useFrames:true});
}
////////////////////////////////////////////////////////////////////////////
killall = function(){//found it necessary to kill all tweens in the project file, though this might work without it
TweenMax.killAll(false, true, true);
}
////////////////////////////////////////////////////////////////////////////
TweenMax scale from visual center?
in GSAP (Flash)
Posted
Hi guys,
I've been looking into a similar problem.... I have a mc that I need to smoohtly zoom in and out of and after days (kid you not, I spent like 2 weeks on this now) of searching I came across tweenmax.... even so I couldn't for the life of me figure it out, but the latest code posted by greensock cleared some stuff up.
I tweaked it to make it work for my purposes, it's in AS2 + my coding skills aren't great so I expect it contains some duplicate and redundant statements, but it works!
this is an extract from my original project, just has the zoom in/out functionality.
you will need a mc and 2 buttons on stage.
main code:
Zoomin button
zoomout button