Aframe: Initializing aframe manually on single page sites

Created on 18 Dec 2015  路  8Comments  路  Source: aframevr/aframe

My single page site, running on Vue.js, has a template with aframe components. The scene doesn't seem to build properly after the Vue component is initialized. Is there a way to trigger the aframe init at runtime, so the Vue component can control when the scene should load?

feature request

Most helpful comment

bump. Is this still the preferred method for initializing aframe later in the stack? And will this defer the loading of assets?

All 8 comments

@thelucre do you have an example scene/site somewhere we can take a look at?

@ngokevin @dmarcos is this possible now in dev?

For now as a workaround, you can add <a-node> to your scene, and then when you are ready, call document.querySelector('a-node').load(). This should work because the scene blocks on all nodes loading before rendering.

heh, that's a beautiful hack. we ought to properly support this, but I like that.

bump. Is this still the preferred method for initializing aframe later in the stack? And will this defer the loading of assets?

It's fine enough, or inject the A-Frame scene into your app when you're ready. I know there are several projects using Vue.js without much issue.

i've been using v-if on the a-scene to render only when other data is ready

This hack work-around does not work when using custom a-marker patterns using AR.js.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

beyerz picture beyerz  路  3Comments

impronunciable picture impronunciable  路  5Comments

donmccurdy picture donmccurdy  路  5Comments

rich311 picture rich311  路  3Comments

ngokevin picture ngokevin  路  5Comments