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

animations do not work #21

Open
Utopiah opened this issue Jun 15, 2018 · 8 comments
Open

animations do not work #21

Utopiah opened this issue Jun 15, 2018 · 8 comments

Comments

@Utopiah
Copy link
Contributor

Utopiah commented Jun 15, 2018

The most basic example works great on desktop, Safari... but somehow not on the XR Viewer. I checked the console (using VorlonJS) and no new error or warning.

<!DOCTYPE html>
<html>
  <head>
    <title>Animation on XR Viewer</title>
    <!-- aframe-xr with dependencies and utils -->
    <script src="https://rawgit.com/mozilla/aframe-xr/master/vendor/aframe-master.js"></script>
    <script src="https://rawgit.com/mozilla/aframe-xr/master/vendor/three.xr.js"></script>
    <script src="https://rawgit.com/mozilla/aframe-xr/master/dist/aframe-xr.js"></script>
  </head>
  <body>

    <a-scene hit-test>
        <a-sphere color="red" radius="0.1" position="5 0 -1">
                <a-animation attribute="radius" dur="1000" fill="forwards" to="0.0001" repeat="indefinite">
                </a-animation>
        </a-sphere>
      
    </a-scene>
  </body>
</html>

Same issue using the dedicated animation component. Is the tick handler behaving as expected?

@Utopiah
Copy link
Contributor Author

Utopiah commented Jun 15, 2018

To go a bit more in depth using my own setInterval function it works, but not relying on animation, the animation component of the tick handlers, cf :

<!DOCTYPE html>
<html>
  <head>
    <title>Animation on XR Viewer</title>
    <script src="http://fabien.benetou.fr:1337/vorlon.js"></script>
    <!-- aframe-xr with dependencies and utils -->
    <script src="https://rawgit.com/mozilla/aframe-xr/master/vendor/aframe-master.js"></script>
    <script src="https://rawgit.com/mozilla/aframe-xr/master/vendor/three.xr.js"></script>
    <script src="https://rawgit.com/mozilla/aframe-xr/master/dist/aframe-xr.js"></script>
  </head>
  <body>
    
<script>  
AFRAME.registerComponent('animationtestmanual', {
  init: function (){
    var el = this.el;
    setInterval( () => {
      var el = this.el;
      el.object3D.rotateY(Math.PI/10)
    }, 100 )
  }
});    
    
AFRAME.registerComponent('animationtest', {  
  tick: function () {
    var el = this.el;
    el.object3D.rotateY(Math.PI/10)
  }
});    
    
</script>    

    <a-scene hit-test>            
        <a-box color="blue" scale="0.1 0.1 0.1" position="1 0 -1" animationtestmanual></a-box>
      
        <a-box color="green" scale="0.1 0.1 0.1" position="3 0 -1" animationtest></a-box>
      
        <a-sphere color="red" radius="0.1" position="5 0 -1">
        <a-animation attribute="radius"
                     dur="1000"
                     fill="forwards"
                     to="0.0001"
                     repeat="indefinite"></a-animation>
        </a-sphere>
      
    </a-scene>
  </body>
</html>

where among the 3 options only the green element is animated.

@vincentfretin
Copy link

@Utopiah try my branch #18

@blairmacintyre
Copy link
Contributor

@vincentfretin I totally "fell off the horse" in terms of pulling in your PRs. @Utopiah does #18 fix your issue? I was going to reply and say "I think this was related to the tick issue that we fixed recently" and then realized I hadn't pulled it in.

(I also need to pull in #19)

@vincentfretin
Copy link

Don't forget mozilla/three.xr.js#11 too ;)

@blairmacintyre
Copy link
Contributor

Just commented over there; I seem to have missed that. (sorry, the last month has been a ton of travel).

@Utopiah
Copy link
Contributor Author

Utopiah commented Jun 27, 2018

Indeed @blairmacintyre , @vincentfretin 's #18 does fix the problem.

@blairmacintyre
Copy link
Contributor

Ok, I pull that PR into develop. I need to test this against our demos (xr-store, apainter) before doing a release, I think.

@Utopiah
Copy link
Contributor Author

Utopiah commented Jun 27, 2018

Right, I didn't notice any regression but I didn't also test in too much depth, only against the above page and also with a larger project using https://github.com/ngokevin/kframe/tree/master/components/animation/ , worked well in all cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants