Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

172
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda