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

example: Start spining after page loaded #17

Merged
merged 3 commits into from
Mar 18, 2019

Conversation

rzr
Copy link
Contributor

@rzr rzr commented Mar 12, 2019

Example to show to programmatically control properties

webthings-webapp-aframe

Change-Id: I140ec2892d3b2a4524183630984b6c7ee7fb6eb9
Relate-to: https://github.com/aframevr/aframe/blob/master/docs/introduction/javascript-events-dom-apis.md
Signed-off-by: Philippe Coval p.coval@samsung.com

@rzr rzr force-pushed the sandbox/rzr/review/master branch from cc64f56 to 93226af Compare March 13, 2019 03:06
rzr added a commit to TizenTeam/aframe-ui-widgets that referenced this pull request Mar 13, 2019
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 <p.coval@samsung.com>
@rzr rzr force-pushed the sandbox/rzr/review/master branch from 93226af to 68c85b1 Compare March 13, 2019 11:30
rzr added a commit to TizenTeam/aframe-ui-widgets that referenced this pull request Mar 13, 2019
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 <p.coval@samsung.com>
@rzr rzr mentioned this pull request Mar 14, 2019
Copy link
Owner

@caseyyee caseyyee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this :) I think besides that, the comment made about setTimeout, the rest looks good.

@@ -95,6 +95,9 @@
clearInterval(interval);
}
});
setTimeout(function(){
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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..

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmm. Yeah, mouse-click and pan is difficult since it's also used for panning/rotating the scene. Any ideas?

rzr added 3 commits March 16, 2019 18:44
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 <p.coval@samsung.com>
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 <p.coval@samsung.com>
Change-Id: I6a3f8c788ead485d0ed9d45856f1132b562b6b61
Signed-off-by: Philippe Coval <p.coval@samsung.com>
@rzr rzr force-pushed the sandbox/rzr/review/master branch from 68c85b1 to 8675493 Compare March 16, 2019 17:46
Copy link
Owner

@caseyyee caseyyee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, going to accept these changes.

Thanks @rzr!

@caseyyee caseyyee merged commit 44f3538 into caseyyee:master Mar 18, 2019
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

Successfully merging this pull request may close these issues.

2 participants