Skip to main content

Create Props

Even though you can create prop configs by either creating its json or using a PropConfigGenerator, you have to include it in the Global Config's Prop List.

You can however interact with a scene's PropContext to modify your prop list.

info

We will only use GlobalConfigGenerator.addProp to demonstrate functionalities later since it uses an underlying PropConfigGenerator.

There are 3 ways to create a prop. We will cover prop's properties later.

  • Create its json and add it to global config's props
  • Use a PropConfigGenerator
    • new GlobalConfigGenerator().addProp((generator)=>generator...) (this gives you a callback with one instance of PropConfigGenerator)
    • const generator = new PropConfigGenerator() and generator.getConfig() (This gives you a prop config object)
new GlobalConfigGenerator()
.addProp((generator) => {
generator.type('TABLE').addPosition((positionGenerator) => {
positionGenerator.x(50).y(50)
})
})
.addProp((generator) => {
generator.type('CAMERA').addPosition((positionGenerator) => {
positionGenerator.x(200).y(200)
})
})