Skip to main content
Participant
June 28, 2017
Answered

Creating a button with zoom in/out functionality in Animate cc

  • June 28, 2017
  • 1 reply
  • 902 views

I need to create a zoom in and zoom out button in addition to a play, stop and pause button for an animation created in Animate canvas. The play, stop and pause buttons are fine, but the zoom buttons are presenting a challenge.  The zoom has to occur on the whole canvas, not just an image. Can anyone direct me to a tutorial that might help?

    This topic has been closed for replies.
    Correct answer UDESCO

    I assume you want to zoom around the Center point. Here's to code to achieve that:

    this.zoomBtn.addEventListener("click", clickHandler);

    exportRoot.x = exportRoot.regX = lib.properties.width/2;

    exportRoot.y = exportRoot.regY = lib.properties.height/2;

    function clickHandler(e) {

      exportRoot.scaleX *= 1.2;

      exportRoot.scaleY *= 1.2;

    }

    1 reply

    UDESCO
    UDESCOCorrect answer
    Participating Frequently
    June 28, 2017

    I assume you want to zoom around the Center point. Here's to code to achieve that:

    this.zoomBtn.addEventListener("click", clickHandler);

    exportRoot.x = exportRoot.regX = lib.properties.width/2;

    exportRoot.y = exportRoot.regY = lib.properties.height/2;

    function clickHandler(e) {

      exportRoot.scaleX *= 1.2;

      exportRoot.scaleY *= 1.2;

    }

    Participant
    June 28, 2017

    Thank you so much for your time, it is really appreciated!