Repository navigation
Customize input options
The advanced options is a JSON object to customize the emitters. If one parameter is not defined in the input, the script take the default value.
The input is a json file with the following paramaters. If the parameter is not define in the input, the script take the default value. This are all the parameters possible to use:
Note that if the value XXXend is not given, but the value XXXstart is given, the start value also overrides the default end value.
| Parameter name | Accepted value | Description | Default value |
|---|---|---|---|
| source | Placeable object id or an object with x and y attributes with default pattern inside | Source of the emission if it's a placeable object id, the source is the center of the object and it follow the object | {x:0,y:0} |
| maxParticles | Number | Max particles allow at the same time for the emitter, if exceed we waiting for a particle to end before emitting another one | 1000 |
| spawningFrequence | Number | Frequence between each emission | 3 |
| spawningNumber | Number | Number of particles emit at during each frequence | 1 |
| emissionDuration | Number | End particles emission at the end of the duration | loop infinitely if undefined |
| freezeOnPause | boolean | Does the emitter and particles stopduring game pause | true |
| particleShape | CIRCLE, TOR, STAR or DIAMOND | Texture used for each sprite | CIRCLE |
| particleVelocityStart | Default pattern | Velocity of the particle at spawning (in px/sec) | 200% |
| particleVelocityEnd | Default pattern | Velocity of the particle at his end (in px/sec) | 50% |
| particleRiseRateStart | Default pattern between -1 and 1 | (Since 2.3.0) Fration of the velocity use to elevate particle at his start (1 go only up, 0 is for horizontal particles and , -0.5 go 30° down) | 0 |
| particleRiseRateEnd | Default pattern between -1 and 1 | Fration of the velocity use to elevate particle at his end (1 go only up, 0 is for horizontal particles and , -0.5 go 30° down) | 0 |
| particleSizeStart | Default pattern of number or object with x and y | Size of the particle at the spawning (in px) | 10 |
| particleSizeEnd | Default pattern of number or object with x and y | Size of the particle at his end (in px) | '10_25' |
| particleRotationStart | Default pattern | Rotation of the particle at the spawning (in degree) | 0 |
| particleRotationEnd | Default pattern | Rotation of the particle at his end (in degree) | 0 |
| particleLifetime | Default pattern | Duration of each particle (in millisec) | [3500,4500] |
| particleColorStart | Object with x, y and z attributes with default pattern between 0 and 255 | Color of the particle at the spawning (in rgb (0 to 255)) | {x:250,y:250, z: 50} |
| particleColorEnd | Object with x, y and z attributes with default pattern between 0 and 255 | Color of the particle at his end (in rgb (0 to 255)) | {x:250,y:'50_100', z: 0} |
| alphaStart | Default pattern between 0 and 1 | Alpha color of the particle at the spawning | 1 |
| alphaEnd | Default pattern between 0 and 1 | Alpha color of the particle at his end | 0 |
| vibrationAmplitudeStart | Default pattern between 0 and 1 | Amplitude of vibration in perpendicular direction of velocity at the spawning (in px) | 0 |
| vibrationAmplitudeEnd | Default pattern between 0 and 1 | Amplitude of vibration in perpendicular direction of velocity at his end (in px) | 0 |
| vibrationFrequencyStart | Default pattern between 0 and 1 | Frequency of vibration in perpendicular direction of velocity at the spawning (in milli-sec) | 0 |
| vibrationFrequencyEnd | Default pattern between 0 and 1 | Frequency of vibration in perpendicular direction of velocity at his end (in milli-sec) | 0 |
| next | Array | More details on Workflow | [] |
| Parameter name | Accepted value | Description | Default value |
|---|---|---|---|
| target | Placeable object id or an object with x and y attributes with default pattern inside | The target of the emission, it use to change the angle of the direction and prolonge lifetime of the particles | undefined |
| positionSpawning | Object with x and y attributes with default pattern inside | Gap coordinate between source and the real position spawning of the particle (in px) | {x:0,y:0} |
| particleAngleStart | Default pattern | Direction of the particle at the spawning (in degrees) | '0_360' |
| particleAngleEnd | Default pattern | Direction of the particle at his end (in degrees) | undefined |
Example To emit particles from a choosen tile direct to a specific token with a constant velocity of 100 px/s
particlesFx.sprayParticles({source :tile.id, target: token.id , particleVelocityStart : 100, particleAngleStart : 0})
In this method the particleVelocityStart and the particleVelocityEnd are angular velocities (degree/sec)
| Parameter name | Accepted value | Description | Default value |
|---|---|---|---|
| particleAngleStart | Default pattern | Angle where the particle spawn (in degree) | '0_360' |
| particleRadiusStart | Default pattern | Distance between particle and source at the spawning (in px) | '100%' |
| particleRadiusEnd | Default pattern | Distance between particle and source at his end (in px) | '50%' |
| particleAxisElevationAngle | Default pattern | (Since 2.3.0) Angle of axis that elevate particles cut the horizontal plane of the source (in degree) | 0 |
| onlyEmitterFollow | boolean | If true only new particle is emit from the new position of the source if it move | false |
Example To emit particles graviting around a choosen token and ending at his center. The living particles will not move with the token
particlesFx.gravitateParticles({source : token.id , particleRadiusStart : '200%', particleRadiusEnd : 5, onlyEmitterFollow : true})
For the majority of the parameters you can use multiple patterns :
- Number (ex:9) : The direct value
- String (ex:'9') : The value converted to Number
- Percent (ex:'9%') : The value multiplied by the grid pixel (ex: if grid size is 50px, '10%' become 5px )
- Undescored String (ex:'9_14') : A random value between the two inclusive boundaries, percent accepted (ex: '10%_30%')
- Array (ex:[9,8,12]) : A random value of the array, the value can be a any of the default pattern (ex: [9,'8','12_15'])
It's corresponding to the texture gived to the generate sprite. The default one is CIRCLE, shown on all gif. But there also are :
diamond

/pfx spray breath diamond
star

/pfx spray breath star
tor

/pfx spray breath tor