Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

173
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda