Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript CSS Rotation through JavaScript with negative values

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #178417
    runonce
    Participant

    Hi, I’ve been reading the article Get Value of CSS Rotation through JavaScript:

    And I have stumble upon the same problem as Josh Eaton, rotation values above 180 degrees:

    But he didn’t mention that there are similar problems with values under -180 degrees and his proposed solution doesn’t cover this issue at all, it just makes it worst.

    I forked the original code and turned all values to negative:

    #178598
    runonce
    Participant

    I need it to fully control the orientation; clockwise or anti-clockwise.

    For example, I’m trying to animate the rotation of an image. If I go from 0 to 90, the rotation is clockwise. But if I rotate the image from 0 to -270 I would get the same result but the animation would be anti-clockwise.

    I just needed the actual value that’s written in the CSS property. If it reads transform: rotate(-9999deg) I wanted to extract the text “rotate(-9999deg)”. I can only think of reading the CSS code as plain text with a regular expression but there must be a better way to control the orientation when animating the rotate property.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.