display.newEmitter()

Type Function
Library display.*
Return value EmitterObject
Revision 2014.2524
Keywords Particle Designer, newEmitter
See also EmitterObject:start()
EmitterObject:stop()
EmitterObject:pause()
Note

This feature is restricted to CoronaCards and the Corona SDK Pro and Corona Enterprise subscription tiers.

Overview

This function is used to create an EmitterObject, used to display particle effects created with Particle Designer.

Syntax

display.newEmitter( emitterParams )
emitterParams (required)

String. The decoded parameters as outputted by Particle Designer in JSON format.

Example

-- Require the JSON library for decoding purposes
local json = require "json"

-- Read the exported Particle Designer file (JSON) into a string
local filePath = system.pathForFile( "fire.json" )
local f = io.open( filePath, "r" )
local fileData = f:read( "*a" )
f:close()

-- Decode the string
local emitterParams = json.decode( fileData )

-- Create the emitter with the decoded parameters
local emitter1 = display.newEmitter( emitterParams )

-- Center the emitter within the content area
emitter1.x = display.contentCenterX
emitter1.y = display.contentCenterY