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 with Events not working #35

Open
joshmarinacci opened this issue Jul 23, 2017 · 5 comments
Open

Animation with Events not working #35

joshmarinacci opened this issue Jul 23, 2017 · 5 comments

Comments

@joshmarinacci
Copy link

I've got a ring which should expand when it emits the 'tapped' event. Using _ref I'm saving a reference to the ring when another click event happens. In the handler I call

this.ring1.emit('tapped');

Is this the correct way to emit aframe events? Is there a better way to trigger animations? thx!

                 <Entity _ref={this.setRing1}
                         geometry={{primitive:'ring', radiusInner:0.5, radiusOuter:1.5}}
                         material={{color:'teal', opacity:1}}
                 >
                     <Entity animation={{
                         attribute:'radius-inner',
                         begin:'tapped',
                         dur:1000,
                         from:0.5,
                         to:9
                     }}/>
                     <Entity animation={{
                         attribute:'radius-outer',
                         begin:'tapped',
                         dur:1000,
                         from:1,
                         to:10
                     }}/>
                     <Entity animation={{
                         attribute:"material.opacity",
                         begin:'tapped',
                         dur:1000,
                         from:1,
                         to:0}}
                     />

                </Entity>
@ngokevin
Copy link
Owner

Bumping aframe-react to latest version might help, but I recommend not using refs for 3D or behavior-related logic. I'd register a component all do all the work inside there.

@joshmarinacci
Copy link
Author

The ref is really just a way for me to get a hold of the ring and call 'emit'. A component would work the same way. I guess my question is really about the animation. Creating an animation entity inside of a ring works fine in standard Aframe but doesn't here. I'm guessing that something inside react is breaking the linkage between the outer element (the ring) and the inner elements (the animations). Have you experienced this before?

@ngokevin
Copy link
Owner

Try bumping aframe-react and use a component to see if it works.

@mocon
Copy link

mocon commented Sep 26, 2017

I am also having this issue on the latest version of aframe-react (4.3.0 at this time).

@dkhan11
Copy link

dkhan11 commented Sep 29, 2017

Hi,

I also have the same problem. My animation are not working on iPad based environment.
Just try running opening https://ngokevin.github.io/aframe-react-boilerplate/ from a Chrome/Safari running on an iPad and you will see the same results. Events are not propagated properly. I tried using the new camera property with aframe version 7.0 but it didn't help either.

Thanks for great work,
D.

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

4 participants