Jump to content
Search Community

witochka

Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by witochka

  1. Greetings guys,

     

    I'm fairly new to GreenSock and Coding, like everyone who is just getting started, I quickly arrived at a point where I don't know how to continue:

     

    I'm working in Adobe Animate and I wanted my movieclip hexagon (InstName = hexagon) to move randomly on my canvas. 

    As an end goal, I wanted several hexagons to move around randomlymaybe even change in size, and I wanted it to play infinitely (screenshots attached).

     

    I found an old tutorial with some code and tried to apply it, but it didn't work. Can anyone tell me why? Is it because I'm using jQuery?

     

    Scripts included:

    https://cdnjs.cloudflare.com/ajax/libs/gsap/1.20.3/TweenMax.min.js

    http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js

     

    Code:

     

    var randX;
    var randY;

    function randomNumbers(){
        
        randX = Math.floor(Math.random()*100);
        randY = Math.floor(Math.random()*150);
        moveMe();
    }

    randomNumbers();

    function moveMe(){
        sym.$("hexagon").animate({left: randX, top: randY},1000, randomNumbers);
    }

     

     

    How can I achieve my goal? Or can anyone please send me a link where a similar topic is solved and discussed?

     

    Any help would be greatly appreciated!

    Bildschirmfoto 2018-01-24 um 10.30.25.png

    Bildschirmfoto 2018-01-24 um 10.30.47.png

×
×
  • Create New...