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

199
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
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