supermedium / aframe-react

:atom: Build virtual reality experiences with A-Frame and React.
https://ngokevin.github.io/aframe-react-boilerplate/
MIT License
1.42k stars 151 forks source link

Assert management #48

Closed jonasfj closed 7 years ago

jonasfj commented 7 years ago

I think we need to create elements for: a-asserts, a-assert-item, audio, img, video https://aframe.io/docs/0.4.0/core/asset-management-system.html

Those can't be created with Entity.

jonasfj commented 7 years ago

Thoughts? I suspect it something we can quickly write..

ngokevin commented 7 years ago

Thanks for feedback. They don't need to be wrapped with React do they? They are usable as DOM elements

jonasfj commented 7 years ago

Sure, but if the <Scene> tag is made with react... We need a react wrapper right?

import {Scene, Entity} from 'aframe-react';

let f = props => {
  return (
    <Scene>
      <a-assets></a-assets>
    </Scene>
  );
}

isn't valid JSX as a-assets isn't defined. Also probably can't be, as it's not a valid JS identifier.

ngokevin commented 7 years ago

custom elements work fine with react now, it'll just do a createElement.

we don't need a react wrapper, even if the Scene is a React Component. The Scene is a React Component because it does serialization to A-Frame for A-Frame components

samburgers commented 7 years ago

Is this the correct way to go about adding an image to the Sky component via a-assets ?

render () {
    return (
        <Scene>
            <a-assets>
                <img id="my-image" src="assets/images/my-image.png" />
            </a-assets>
            <Sky src="#my-image"></Sky>
        </Scene>
    )
}