Emitter2DPlugin

View source

ExtendsPlugin

Adds 2D particle emission and lifetime cleanup to an App.

Enabled entities with an Emitter, a GlobalTransform2D, and a Timer emit world-space particles when a configured emission cycle begins. Each particle receives the emitter’s current position and orientation and is removed after its lifetime is complete.

The plugin requires CorePlugin, CommandsPlugin, TimePlugin, and Transform2DPlugin. Register these dependencies before registering this plugin; the app checks them but does not install them automatically.

Examples

import { App } from '@wimaengine/app'
import { CommandsPlugin } from '@wimaengine/command'
import { CorePlugin } from '@wimaengine/core'
import { Emitter2DPlugin } from '@wimaengine/emitter'
import { TimePlugin } from '@wimaengine/time'
import { Transform2DPlugin } from '@wimaengine/transform'

new App()
  .registerPlugin(new CorePlugin())
  .registerPlugin(new CommandsPlugin())
  .registerPlugin(new TimePlugin())
  .registerPlugin(new Transform2DPlugin())
  .registerPlugin(new Emitter2DPlugin())
  .run()

Constructor


constructor()

Methods


register(app: App): void

View source

Enables 2D particle emission and lifetime cleanup for the app.

Parameters

NameDescriptionDefault
app

App to configure.

—

requires(): TypeId[]

View source

Returns the plugin IDs required for 2D particle emission and cleanup.

Returns

Required plugin TypeId values.