Skip to main content

Create Animation Configs

Even though you can create position configs by either creating its json or using a PositionConfigGenerator, you have to include it in the Prop Config's frameAnimationConfig.

info

We will only use PropConfigGenerator.addPosition to demonstrate functionalities later since it uses an underlying PositionConfigGenerator.

There are 3 ways to create a prop's position:

  • Create its json and add it to prop's frameAnimationConfig
  • Use a PositionConfigGenerator
    • new PropConfigGenerator().addPosition((generator)=>generator...) (this gives you a callback with one instance of PositionConfigGenerator)
    • const generator = new PositionConfigGenerator() and generator.getConfig() (This gives you an animation config object)

Required properties

If you include a prop in the scene, it has to contain at least 1 animation config at any frame.

For every animation config, the property x and y (which defines where the prop's going to be placed at that frame) are required.

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)
})
})