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

207
Visualizações
can anyone show an example of using animations programmatically via Aframe i.e. create and change properites via javascript

The following code does not produce any animation. I want to use the bottom script tag to programmatically create and change animations. thanks for the help

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>TANACH-CHUNKS</title>
<meta name="description" content="Cursor - A-Frame">
<script src="js/aframe.min.js"></script>
</head>
<body>
<a-scene id = "sceneEl">   
<a-entity
position="0 -1.5 2.5"
>
<a-camera
id="camera"
keyboard-controls="enabled: true"
wasd-controls="acceleration: 10; enabled: false; adAxis:x"
>
<a-entity 
cursor="rayOrigin: mouse; fuse: true; fuseTimeout: 500" 
id="cursor1"
position="0 0 -1"
geometry="primitive: ring; radiusInner: 0.001; radiusOuter: 0.01"
material="color: blue; shader: flat"
>
</a-entity>
</a-camera>
</a-entity>
</a-entity>             
<a-entity id="box" geometry="primitive: box" material="color: red" position="0 0 0" rotation="0 30 0"
animation__mouseup="property: components.material.material.color; type: color; from: red; to: blue; startEvents: mouseup; dur: 5000"
animation__mouseup="property: components.material.material.color; type: color; from: blue; to: red; startEvents: mouseup; dur: 5000"
>
</a-entity> 
<script>
box.setAttribute("animation","property: position; to: 2 2 0; dur: 2000;");
</script>
</body>
</html>
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Your animation property code works as expected, but other errors (namely, an extraneous </a-entity> tag in the middle and missing tags at the end) prevent it from compiling. Here is the same code cleaned up, which works for me (assuming your path to aframe.min.js is correct):

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>TANACH-CHUNKS</title>
    <meta name="description" content="Cursor - A-Frame" />
    <script src="js/aframe.min.js"></script>
  </head>
  <body>
    <a-scene id="sceneEl">
      <a-entity position="0 -1.5 2.5">
        <a-camera
          id="camera"
          keyboard-controls="enabled: true"
          wasd-controls="acceleration: 10; enabled: false; adAxis:x"
        >
          <a-entity
            cursor="rayOrigin: mouse; fuse: true; fuseTimeout: 500"
            id="cursor1"
            position="0 0 -1"
            geometry="primitive: ring; radiusInner: 0.001; radiusOuter: 0.01"
            material="color: blue; shader: flat"
          ></a-entity>
        </a-camera>
      </a-entity>
      <a-entity
        id="box"
        geometry="primitive: box"
        material="color: red"
        position="0 0 0"
        rotation="0 30 0"
        animation__mouseup="property: components.material.material.color; type: color; from: red; to: blue; startEvents: mouseup; dur: 5000"
        animation__mousedown="property: components.material.material.color; type: color; from: blue; to: red; startEvents: mousedown; dur: 5000"
      >
      </a-entity>
    </a-scene>
  </body>
</html>
about 4 years ago · Juan Pablo Isaza Relatório
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