Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

168
Views
Changing the point an element rotates around

When I set the transform origin of an element in javascript and then rotate it, it still rotates around the original point from before I changed it and then moves to where it would end if it rotated around the new origin. However, if I wait for a bit and then rotate the element, it rotates around the correct origin. Is it possible to make it so that I don't have to add a pause before the rotation?

function complete() {
    var plane = document.getElementById("plane");
    plane.style.transform = "rotateZ(90deg)";
}
            
function turn(move) {
    var plane = document.getElementById("plane");
    plane.classList.add("twisting");
    var target_side = document.getElementsByClassName(move);
    for (let i = 0; i < target_side.length; i++) {
        let cube_face = target_side[i];
        plane.appendChild(cube_face);
    }
    plane.style.transformOrigin = "0px 480 px";
    setTimeout(complete, 100);
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!