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

entity.setAttribute does not Render new Color, although Updates DOM #27

Open
kkruups opened this issue Jun 19, 2017 · 0 comments
Open

Comments

@kkruups
Copy link

kkruups commented Jun 19, 2017

Problem:

Calling entity.setAttribute to change color updates the DOM, however does not render the new color (even when the entity has an element which refreshes per each frame).

Code Excerpt:

=================

...<html>
<!-- initial color: green -->
<a-entity debug  id="rain" particle-system="preset: rain; color: #00ff00; particleCount: 5000"></a-entity>
...</html>

JS

var rain = document.querySelector('#rain')
rain.setAttribute('particle-system', {preset: 'snow', color: '#ff0000'});  //color: red

DOM Updated:
["components"]['particle-system']['data']['color'] =[ #ff0000 ], however not rendered.

================
Expected Behavior: change in color via entity.setAttribute results in change in color w/o having to remove the particle-system component from the entity.

WorkAround

In order to get the color to update need to call removeAttribute then setAttribute

var rain = document.querySelector('#rain');
rain.removeAttribute('particle-system');
rain.setAttribute('particle-system', {preset: 'snow', color: '#ff0000'});  //color: red

====================
Additional Info: [debug] aframe component added to force update on each frame, however setAttribute does not behave as expected.


Is this API not designed to update after the page is loaded?

Please advise.

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

1 participant