1 Reply Latest reply on Feb 5, 2014 5:36 AM by resdesign

    Random Rotation on click


      I have a banner I have been working on with three spinners like a slot machine.  Currently I have everything hand animated to rotate the spinners to spin to one of 4 options each.  What I would like is to have a button that triggers the spinners to rotate to a random ( 1 of 4 ) points over the course of 1/2 second 500ns. 


      Is there a code snippit that will make an object rotate to one of 4 chosen variables?

        • 1. Re: Random Rotation on click
          resdesign Adobe Community Professional & MVP

          Hello; here is an example of a spinner I made. This is probably different from what you are doing but it will give you an idea of what you can do.



          var spinner1 = sym.$('spinner1');


          // randomize the degree of spin.

                    var myVar1 = Math.floor((Math.random()*180)+10);




                              '-webkit-transform': 'rotate(' + myVar1 + 'deg)',

                              '-moz-transform': 'rotate(' + myVar1 + 'deg)',

                              '-ms-transform': 'rotate(' + myVar1 + 'deg)',

                              '-o-transform': 'rotate(' + myVar1 + 'deg)',

                              'transform': 'rotate(' + myVar1 + 'deg)',


             spinner1.css('-moz-transition','all 500ms cubic-bezier(0.420, 0.000, 1.000, 1.000)');


          1 person found this helpful