Reputation: 90
given an entity
<a-entity animation__foo="" animation__bar""> </a-entity>
I would like to
entity.setAttribute("animation__foo", "enabled: false;");
entity.setAttribute("animation__bar", "enabled: false;");
what is the proper syntax to do this? and is it possible to set the attributes at the same time in a single command?
Upvotes: 1
Views: 2475
Reputation: 14665
From the source code:
setAttribute can:
1. Set a single property of a multi-property component.
2. Set multiple properties of a multi-property component.
3. Replace properties of a multi-property component.
4. Set a value for a single-property component, mixin, or normal HTML attribute.
So, for a single property change, just do
entity.setAttribute("animation__foo", "enabled", "false;");
for multiple properties, try
entity.setAttribute("foo", {
"one": "foo",
"two": "bar"})
Example here.
setAttribute()
, it's not possible.
Upvotes: 3