example: Start spining after page loaded#17
Conversation
cc64f56 to
93226af
Compare
Example to show to programmatically control properties Change-Id: I140ec2892d3b2a4524183630984b6c7ee7fb6eb9 Bug: caseyyee#17 Relate-to: https://github.com/aframevr/aframe/blob/master/docs/introduction/javascript-events-dom-apis.md Signed-off-by: Philippe Coval <[email protected]>
93226af to
68c85b1
Compare
Start spining after page loaded Example to show to programmatically control properties Change-Id: I140ec2892d3b2a4524183630984b6c7ee7fb6eb9 Bug: caseyyee#17 Relate-to: https://github.com/rzr/webthing-iotjs/wiki/XR Signed-off-by: Philippe Coval <[email protected]>
caseyyee
left a comment
There was a problem hiding this comment.
Thanks for this :) I think besides that, the comment made about setTimeout, the rest looks good.
| clearInterval(interval); | ||
| } | ||
| }); | ||
| setTimeout(function(){ |
There was a problem hiding this comment.
Maybe rather than doing a setTimeout, we can just set the value to 1 in the markup so that it is spinning from the start?
There was a problem hiding this comment.
Well I can change this to static, but I the reason I prefered to delay the start was mostly to show how to change attribute dynamically from javascript... this is where that update method is relevant... so I thought this example will illustrate more the real use.
For the context I plan to use widgets also in read only mode and change them from external events, eg:
http://github.com/SamsungInternet/color-sensor-js
There was a problem hiding this comment.
I see. Just don't want anyone confused about why the value changed if they don't look at the code. Maybe one possibility is to hook up one of the buttons so that it toggles the switch? A bit of labeling using <a-text> would go a long way as well. See https://aframe.io/docs/0.9.0/primitives/a-text.html
Given that the repo is pretty old, i'm going to bump the a-frame version up to something more current. Hopefully that won't break anything for you?
There was a problem hiding this comment.
yea this is what i am actually doing with my code ...
I have tested current aframe it seems to work , but I need to sort out how to use slider with mouse or gearvr2 controller..
There was a problem hiding this comment.
Mmm. Yeah, mouse-click and pan is difficult since it's also used for panning/rotating the scene. Any ideas?
This change allows an element to be changed programmatically:
```js
valueSlider.setAttribute('ui-slider', 'value', Math.random());
```
Change-Id: I140ec2892d3b2a4524183630984b6c7ee7fb6eb9
Bug: caseyyee#17
Relate-to: https://github.com/rzr/webthing-iotjs/wiki/XR
Signed-off-by: Philippe Coval <[email protected]>
This change allows an element to be changed programmatically:
```js
let value = Number(valueSlider.getAttribute('ui-slider')['max'] || 1);
value *= Math.random();
valueSlider.setAttribute('ui-slider', 'value', value);
```
Change-Id: Ie9c2fa400ffaf2b555cee9d7f81fa9f4c4977d36
Bug: caseyyee#17
Relate-to: https://github.com/rzr/webthing-iotjs/wiki/XR
Signed-off-by: Philippe Coval <[email protected]>
Change-Id: I6a3f8c788ead485d0ed9d45856f1132b562b6b61 Signed-off-by: Philippe Coval <[email protected]>
68c85b1 to
8675493
Compare
Example to show to programmatically control properties
Change-Id: I140ec2892d3b2a4524183630984b6c7ee7fb6eb9
Relate-to: https://github.com/aframevr/aframe/blob/master/docs/introduction/javascript-events-dom-apis.md
Signed-off-by: Philippe Coval [email protected]