0 Replies Latest reply on Feb 14, 2018 10:31 AM by sudeshprathapv

    Explain this - Square Rolling Script in Detail

    sudeshprathapv Level 1

      Sorry for your time.

       

      I know it's Rookie doubt and I had to study about Script first. But I almost understand this script.

       

      Only thing I don't get is Line 4: val = ( num % 4);

       

       

      The expression on the anchor point of the square:

      count = Math.floor(rotation / 90);
      num = count + 100;
      val = ( num % 4);

      if (val == 0) {
        [width, height]
      }
      else if (val == 1) {
        [width, 0]
      }
      else if (val == 2) {
        [0, 0]
      }
      else
        [0, height]

       

       

      The expression on the Position of the square:

      val = Math.floor(rotation / 90);

      x = value[0] + val * width;

      y = value[1];

      [x, y]