Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animation does not work for cube and torus #34126

Open
imperatormatthias opened this issue Jun 13, 2024 · 2 comments · May be fixed by #34159
Open

Animation does not work for cube and torus #34126

imperatormatthias opened this issue Jun 13, 2024 · 2 comments · May be fixed by #34159
Labels
Content:Games Games docs help wanted If you know something about this topic, we would love your help!

Comments

@imperatormatthias
Copy link

imperatormatthias commented Jun 13, 2024

MDN URL

https://developer.mozilla.org/en-US/docs/Games/Techniques/3D_on_the_web/Building_up_a_basic_demo_with_A-Frame

What specific section or headline is this issue about?

Animation

What information was incorrect, unhelpful, or incomplete?

The instructions on how to animate the cube and torus

What did you expect to see?

Expected animation of the cube and torus by following the given instructions

Do you have any supporting links, references, or citations?

No response

Do you have anything more you want to share?

Tried in FF and edge and only the cylinder animates. The link to the file on github here: https://github.com/end3r/MDN-Games-3D/blob/gh-pages/A-Frame/shapes.html also does not display the cube and the torus does not animate.

MDN metadata

Page report details
@imperatormatthias imperatormatthias added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Jun 13, 2024
@github-actions github-actions bot added the Content:Games Games docs label Jun 13, 2024
@low-perry
Copy link
Contributor

low-perry commented Jun 14, 2024

After reading the A-FRAME docs, for animation, the following changes need to be made:

<!-- 1 -->
<a-box color="#0095DD" rotation="20 40 0" position="0 1 0">
      <a-animation 
      attribute="rotation"
      from="20 0 0" to="20 360 0"
      direction="alternate"
      dur="4000"
      repeat="indefinite"
      easing="ease">
    </a-animation>
</a-box>
<!-- replace code above with the following -->
<a-box color="#0095DD" position="0 1 0" rotation="20 40 0" animation="property: rotation;from:20 0 0; to: 20 360 0;dir: alternate; loop: true; dur: 4000; easing: easeInOutQuad;"></a-box>

<!-- 2 -->
  <a-entity 
  geometry="
  primitive: torus;
  radius: 1;
  radiusTubular: 0.1;
  segmentsTubular: 12;" 
  material="color: #EAEFF2;
  roughness: 0.1;
  metalness: 0.5;"
  rotation="10 0 0"
  position="-3 1 0">
    <a-animation attribute="scale" to="1 0.5 1" direction="alternate" dur="2000" repeat="indefinite" easing="linear"></a-animation>
    </a-entity>

    <!-- replace code above with the following -->
    <a-entity
            geometry="
            primitive: torus;
            radius: 1;
            radiusTubular: 0.1;
            segmentsTubular: 12;"
            material="
            color: #EAEFF2;
            roughness: 0.1;
            metalness: 0.5;"
            rotation="10 0 0"
            position="-3 1 0"
            animation="property: scale; to: 1 0.5 1; dir: alternate; dur: 2000; repeat: true; easing: linear;">
        
      </a-entity>
@imperatormatthias
Copy link
Author

This seems to work except for the torus animation property "direction: alternate" should be "dir: alternate" and "repeat: indefinite" should be "loop: true" based on the A-FRAME docs.

@Josh-Cena Josh-Cena added help wanted If you know something about this topic, we would love your help! and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:Games Games docs help wanted If you know something about this topic, we would love your help!
3 participants