Timer + Aframe : How to use setTimeOut for Aframe.registercomponent(“…”)
up vote
1
down vote
favorite
I know it's a beginner's question but I have a bit of trouble with html / javascript.
I learned about the setTimeout (function, time) and I knew how to use it by creating a function.
However, I was wondering if it is possible to use this setTimeOut for Aframe.registercomponent my other scripts? I didn't find anything on that and all my attempts failed.
For example for the "audioanalyser-waveform":
AFRAME.registerComponent('audioanalyser-waveform', {
dependencies: ['audioanalyser'],
schema:
maxHeight: default: 0.2,
multiplier: default: .01,
radius: default: 1,
,
init: function ()
this.colors = ;
this.geometry;
this.levels = ;
this.noisePos = 0;
this.rings = ;
,
update: function () {
setTimeout(Color, 4000);
var data = this.data;
var el = this.el;
var i;
...
...
This one is in my wave.js script
and i know i can call it in my index.html with the tags:
<a-entity id="analyser"
audioanalyser="src: #song"
audioanalyser-waveform="radius: 1"
rotation="210 0 0"
position="0 100 -150"
></a-entity>
And it would have been so simple if I could add that :
<script> setTimeout(audioanalyser-waveform, 4000); </script>
But it doesn't work like that and I don't have idea how to set the start / stop of an Aframe.registercomponent to choose its seconds of play.
Can you help me please...
Pulsar,
html time components settimeout aframe
add a comment |
up vote
1
down vote
favorite
I know it's a beginner's question but I have a bit of trouble with html / javascript.
I learned about the setTimeout (function, time) and I knew how to use it by creating a function.
However, I was wondering if it is possible to use this setTimeOut for Aframe.registercomponent my other scripts? I didn't find anything on that and all my attempts failed.
For example for the "audioanalyser-waveform":
AFRAME.registerComponent('audioanalyser-waveform', {
dependencies: ['audioanalyser'],
schema:
maxHeight: default: 0.2,
multiplier: default: .01,
radius: default: 1,
,
init: function ()
this.colors = ;
this.geometry;
this.levels = ;
this.noisePos = 0;
this.rings = ;
,
update: function () {
setTimeout(Color, 4000);
var data = this.data;
var el = this.el;
var i;
...
...
This one is in my wave.js script
and i know i can call it in my index.html with the tags:
<a-entity id="analyser"
audioanalyser="src: #song"
audioanalyser-waveform="radius: 1"
rotation="210 0 0"
position="0 100 -150"
></a-entity>
And it would have been so simple if I could add that :
<script> setTimeout(audioanalyser-waveform, 4000); </script>
But it doesn't work like that and I don't have idea how to set the start / stop of an Aframe.registercomponent to choose its seconds of play.
Can you help me please...
Pulsar,
html time components settimeout aframe
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I know it's a beginner's question but I have a bit of trouble with html / javascript.
I learned about the setTimeout (function, time) and I knew how to use it by creating a function.
However, I was wondering if it is possible to use this setTimeOut for Aframe.registercomponent my other scripts? I didn't find anything on that and all my attempts failed.
For example for the "audioanalyser-waveform":
AFRAME.registerComponent('audioanalyser-waveform', {
dependencies: ['audioanalyser'],
schema:
maxHeight: default: 0.2,
multiplier: default: .01,
radius: default: 1,
,
init: function ()
this.colors = ;
this.geometry;
this.levels = ;
this.noisePos = 0;
this.rings = ;
,
update: function () {
setTimeout(Color, 4000);
var data = this.data;
var el = this.el;
var i;
...
...
This one is in my wave.js script
and i know i can call it in my index.html with the tags:
<a-entity id="analyser"
audioanalyser="src: #song"
audioanalyser-waveform="radius: 1"
rotation="210 0 0"
position="0 100 -150"
></a-entity>
And it would have been so simple if I could add that :
<script> setTimeout(audioanalyser-waveform, 4000); </script>
But it doesn't work like that and I don't have idea how to set the start / stop of an Aframe.registercomponent to choose its seconds of play.
Can you help me please...
Pulsar,
html time components settimeout aframe
I know it's a beginner's question but I have a bit of trouble with html / javascript.
I learned about the setTimeout (function, time) and I knew how to use it by creating a function.
However, I was wondering if it is possible to use this setTimeOut for Aframe.registercomponent my other scripts? I didn't find anything on that and all my attempts failed.
For example for the "audioanalyser-waveform":
AFRAME.registerComponent('audioanalyser-waveform', {
dependencies: ['audioanalyser'],
schema:
maxHeight: default: 0.2,
multiplier: default: .01,
radius: default: 1,
,
init: function ()
this.colors = ;
this.geometry;
this.levels = ;
this.noisePos = 0;
this.rings = ;
,
update: function () {
setTimeout(Color, 4000);
var data = this.data;
var el = this.el;
var i;
...
...
This one is in my wave.js script
and i know i can call it in my index.html with the tags:
<a-entity id="analyser"
audioanalyser="src: #song"
audioanalyser-waveform="radius: 1"
rotation="210 0 0"
position="0 100 -150"
></a-entity>
And it would have been so simple if I could add that :
<script> setTimeout(audioanalyser-waveform, 4000); </script>
But it doesn't work like that and I don't have idea how to set the start / stop of an Aframe.registercomponent to choose its seconds of play.
Can you help me please...
Pulsar,
html time components settimeout aframe
html time components settimeout aframe
asked Nov 8 at 19:54
Pulsar19
83
83
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
What are you trying to accomplish? Can you have a component that sets audioanalyser-waveform
after 4000ms?
<a-entity id="analyser"
audioanalyser="src: #song"
rotation="210 0 0"
position="0 100 -150"
your-component
></a-entity>
Component code:
AFRAME.registerComponent('your-component',
...
init: function ()
setTimeout(() =>
this.el.setAttribute('audioanalyser-waveform', radius: 1);
, 4000)
...
);
I try to create an ""animation music video" and my video must match the music. Yes, it is working ! Thank you !! Mmmh... is it possible to stop my component after 8000ms for example ? (Thanks)
– Pulsar19
Nov 8 at 21:59
UsingsetTimeout
is probably not the best way to sync with music but you can dothis.el.removeAttribute('audioanalyser-waveform')
or define methodsstart / stop
in your component that you can call:this.el.components['audioanalyser-waveform'].start()
– Diego Marcos
Nov 8 at 22:43
Sorry I didn't see your answer yesterday. I have some difficult to write these methods start/stop, it is why I prefer setTimeout haha :^) Thank you so much for your help, it is working ! Good evening Diego !
– Pulsar19
Nov 9 at 20:26
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
What are you trying to accomplish? Can you have a component that sets audioanalyser-waveform
after 4000ms?
<a-entity id="analyser"
audioanalyser="src: #song"
rotation="210 0 0"
position="0 100 -150"
your-component
></a-entity>
Component code:
AFRAME.registerComponent('your-component',
...
init: function ()
setTimeout(() =>
this.el.setAttribute('audioanalyser-waveform', radius: 1);
, 4000)
...
);
I try to create an ""animation music video" and my video must match the music. Yes, it is working ! Thank you !! Mmmh... is it possible to stop my component after 8000ms for example ? (Thanks)
– Pulsar19
Nov 8 at 21:59
UsingsetTimeout
is probably not the best way to sync with music but you can dothis.el.removeAttribute('audioanalyser-waveform')
or define methodsstart / stop
in your component that you can call:this.el.components['audioanalyser-waveform'].start()
– Diego Marcos
Nov 8 at 22:43
Sorry I didn't see your answer yesterday. I have some difficult to write these methods start/stop, it is why I prefer setTimeout haha :^) Thank you so much for your help, it is working ! Good evening Diego !
– Pulsar19
Nov 9 at 20:26
add a comment |
up vote
0
down vote
accepted
What are you trying to accomplish? Can you have a component that sets audioanalyser-waveform
after 4000ms?
<a-entity id="analyser"
audioanalyser="src: #song"
rotation="210 0 0"
position="0 100 -150"
your-component
></a-entity>
Component code:
AFRAME.registerComponent('your-component',
...
init: function ()
setTimeout(() =>
this.el.setAttribute('audioanalyser-waveform', radius: 1);
, 4000)
...
);
I try to create an ""animation music video" and my video must match the music. Yes, it is working ! Thank you !! Mmmh... is it possible to stop my component after 8000ms for example ? (Thanks)
– Pulsar19
Nov 8 at 21:59
UsingsetTimeout
is probably not the best way to sync with music but you can dothis.el.removeAttribute('audioanalyser-waveform')
or define methodsstart / stop
in your component that you can call:this.el.components['audioanalyser-waveform'].start()
– Diego Marcos
Nov 8 at 22:43
Sorry I didn't see your answer yesterday. I have some difficult to write these methods start/stop, it is why I prefer setTimeout haha :^) Thank you so much for your help, it is working ! Good evening Diego !
– Pulsar19
Nov 9 at 20:26
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
What are you trying to accomplish? Can you have a component that sets audioanalyser-waveform
after 4000ms?
<a-entity id="analyser"
audioanalyser="src: #song"
rotation="210 0 0"
position="0 100 -150"
your-component
></a-entity>
Component code:
AFRAME.registerComponent('your-component',
...
init: function ()
setTimeout(() =>
this.el.setAttribute('audioanalyser-waveform', radius: 1);
, 4000)
...
);
What are you trying to accomplish? Can you have a component that sets audioanalyser-waveform
after 4000ms?
<a-entity id="analyser"
audioanalyser="src: #song"
rotation="210 0 0"
position="0 100 -150"
your-component
></a-entity>
Component code:
AFRAME.registerComponent('your-component',
...
init: function ()
setTimeout(() =>
this.el.setAttribute('audioanalyser-waveform', radius: 1);
, 4000)
...
);
answered Nov 8 at 21:37
Diego Marcos
1,5851913
1,5851913
I try to create an ""animation music video" and my video must match the music. Yes, it is working ! Thank you !! Mmmh... is it possible to stop my component after 8000ms for example ? (Thanks)
– Pulsar19
Nov 8 at 21:59
UsingsetTimeout
is probably not the best way to sync with music but you can dothis.el.removeAttribute('audioanalyser-waveform')
or define methodsstart / stop
in your component that you can call:this.el.components['audioanalyser-waveform'].start()
– Diego Marcos
Nov 8 at 22:43
Sorry I didn't see your answer yesterday. I have some difficult to write these methods start/stop, it is why I prefer setTimeout haha :^) Thank you so much for your help, it is working ! Good evening Diego !
– Pulsar19
Nov 9 at 20:26
add a comment |
I try to create an ""animation music video" and my video must match the music. Yes, it is working ! Thank you !! Mmmh... is it possible to stop my component after 8000ms for example ? (Thanks)
– Pulsar19
Nov 8 at 21:59
UsingsetTimeout
is probably not the best way to sync with music but you can dothis.el.removeAttribute('audioanalyser-waveform')
or define methodsstart / stop
in your component that you can call:this.el.components['audioanalyser-waveform'].start()
– Diego Marcos
Nov 8 at 22:43
Sorry I didn't see your answer yesterday. I have some difficult to write these methods start/stop, it is why I prefer setTimeout haha :^) Thank you so much for your help, it is working ! Good evening Diego !
– Pulsar19
Nov 9 at 20:26
I try to create an ""animation music video" and my video must match the music. Yes, it is working ! Thank you !! Mmmh... is it possible to stop my component after 8000ms for example ? (Thanks)
– Pulsar19
Nov 8 at 21:59
I try to create an ""animation music video" and my video must match the music. Yes, it is working ! Thank you !! Mmmh... is it possible to stop my component after 8000ms for example ? (Thanks)
– Pulsar19
Nov 8 at 21:59
Using
setTimeout
is probably not the best way to sync with music but you can do this.el.removeAttribute('audioanalyser-waveform')
or define methods start / stop
in your component that you can call: this.el.components['audioanalyser-waveform'].start()
– Diego Marcos
Nov 8 at 22:43
Using
setTimeout
is probably not the best way to sync with music but you can do this.el.removeAttribute('audioanalyser-waveform')
or define methods start / stop
in your component that you can call: this.el.components['audioanalyser-waveform'].start()
– Diego Marcos
Nov 8 at 22:43
Sorry I didn't see your answer yesterday. I have some difficult to write these methods start/stop, it is why I prefer setTimeout haha :^) Thank you so much for your help, it is working ! Good evening Diego !
– Pulsar19
Nov 9 at 20:26
Sorry I didn't see your answer yesterday. I have some difficult to write these methods start/stop, it is why I prefer setTimeout haha :^) Thank you so much for your help, it is working ! Good evening Diego !
– Pulsar19
Nov 9 at 20:26
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53215206%2ftimer-aframe-how-to-use-settimeout-for-aframe-registercomponent%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown