Copy link to clipboard
Copied
Hi all,
I've got a my animation pretty much how I want it, now I want my animation to zoom in smoothly when the mouse is over and back again when out.
var cameraObj = AdobeAn.VirtualCamera.getCamera(exportRoot);
this.mouseOver.addEventListener("mouseover", MouseOverHandler);
function MouseOverHandler(){
cameraObj.zoomBy(110);
}
this.mouseOver.addEventListener("mouseout", MouseOutHandler);
function MouseOutHandler(){
cameraObj.resetZoom();
}
I've got the mouse over/out working but the animation jumps to zoom 110 instead of tweening from 100 to 110. How would I go about this?
Thanks!
Edit: You need to have the zoomBy command inside your tick function
example code:
createjs.Ticker.addEventListener('tick', stage);
var over = false;
function stage(){
if(over == true && cameraObj.getZoom() < 120){ //Will zoom in until 120%
cameraObj.zoomBy(100.5);
}
}
this.LAYERNAME.addEventListener("mouseover", MouseOverHandler);
function MouseOverHandler(){
over = true;
}
Have something to add?