1.0.4 • Published 6 years ago

aframe-spe-particles-component v1.0.4

Weekly downloads
60
License
MIT
Repository
github
Last release
6 years ago

aframe-spe-particles-component

The spe-particles component provides a wrapper around the Shader Particle Engine by SquareFeet, for generating GPU based particle systems in A-Frame. The system supports single textures and spritesheets, settings for position, velocity, acceleration, color, opacity, rotation, size, drag and wiggle.

Demo

Screenshot

Example

<head>
  <script src="https://aframe.io/releases/0.8.0/aframe.min.js"></script>
  <script src="https://unpkg.com/aframe-spe-particles-component@^1.0.4/dist/aframe-spe-particles-component.min.js"></script>
</head>

<body>
  <a-entity particles="texture: /assets/blob.png; color: blue; velocity: 0 10 0; velocity-spread: 2 0 2; acceleration: 0 -10 0"></a-entity>
</body>

Value

PropertyDescriptionDefault ValueType
accelerationfor sphere and disc distributions, only the x axis is used{x: 0, y: 0, z: 0}vec3
acceleration-distributiondistribution of particle acceleration, for disc and sphere, only the x component will be used. if set to NONE use the 'distribution' attribute for accelerationDistribution'NONE''NONE', 'BOX', 'SPHERE', 'DISC'
acceleration-spreadspread of the particle's acceleration. for sphere and disc distributions, only the x axis is used{x: 0, y: 0, z: 0}vec3
active-multipliermultiply the rate of particles emission, if larger than 1 then the particles will be emitted in bursts. note, very large numbers will emit all particles at once1number
affected-by-fogif true, the particles are affected by THREE js fogtrueboolean
alpha-testalpha values below the alphaTest threshold are considered invisible0number
angle2D rotation of the particle over the particle's lifetime, max 4 elements0array
angle-spreadspread in angle over the particle's lifetime, max 4 elements0array
blendingblending mode, when drawing particles'normal''no', 'normal', 'additive', 'subtractive', 'multiply', 'custom'
colorarray of colors over the particle's lifetime, max 4 elements'#fff'array
color-spreadspread to apply to colors, spread an array of vec3 (r g b) with 0 for no spread. note the spread will be re-applied through-out the lifetime of the particle[]array
depth-testif true, don't render a particle's pixels if something is closer in the depth buffertrueboolean
depth-writeif true, particles write their depth into the depth buffer. this should be false if we use transparent particlesfalseboolean
directionmake the emitter operate forward or backward in time'forward''forward', 'backward'
distributiondistribution for particle positions, velocities and acceleration. will be overriden by specific '...Distribution' attributes'BOX''BOX', 'SPHERE', 'DISC'
dragapply resistance to moving the particle, 0 is no resistance, 1 is full resistance, particle will stop moving at half of it's maxAge0number
drag-spreadspread to apply to the drag attribute0number
durationduration of the emitter (seconds), if less than 0 then continuously emit particles-1number
emitter-scaleglobal scaling factor for all particles from the emitter100number
enable-in-editorenable the emitter while the editor is active (i.e. while scene is paused)falseboolean
enabledenable/disable the emittertrueboolean
frustum-culledenable/disable frustum cullingfalseboolean
has-perspectiveif true, particles will be larger the closer they are to the cameratrueboolean
max-agemaximum age of a particle before reusing1number
max-age-spreadvariance for the 'maxAge' attribute0number
opacityopacity over the particle's lifetime, max 4 elements1array
opacity-spreadspread in opacity over the particle's lifetime, max 4 elements0array
particle-countmaximum number of particles for this emitter100int
position-distributiondistribution of particle positions, disc and sphere will use the radius attributes. For box particles emit at 0,0,0, for sphere they emit on the surface of the sphere and for disc on the edge of a 2D disc on the XY plane'NONE''NONE', 'BOX', 'SPHERE', 'DISC'
position-offsetfixed offset to the apply to the emitter relative to its parent entity{x: 0, y: 0, z: 0}vec3
position-spreadparticles are positioned within +- of these local bounds. for sphere and disc distributions only the x axis is used{x: 0, y: 0, z: 0}vec3
radiusradius of the disc or sphere emitter (ignored for box). note radius of 0 will prevent velocity and acceleration if they use a sphere or disc distribution1number
radius-scalescales the emitter for sphere and disc shapes to form oblongs and ellipses{x: 1, y: 1, z: 1}vec3
randomize-accelerationif true, re-randomize acceleration when re-spawning a particle, can incur a performance hitfalseboolean
randomize-angleif true, re-randomize angle when re-spawning a particle, can incur a performance hitfalseboolean
randomize-colorif true, re-randomize colour when re-spawning a particle, can incur a performance hitfalseboolean
randomize-dragif true, re-randomize drag when re-spawning a particle, can incur a performance hitfalseboolean
randomize-opacityif true, re-randomize opacity when re-spawning a particle, can incur a performance hitfalseboolean
randomize-positionif true, re-randomize position when re-spawning a particle, can incur a performance hitfalseboolean
randomize-rotationif true, re-randomize rotation when re-spawning a particle, can incur a performance hitfalseboolean
randomize-sizeif true, re-randomize size when re-spawning a particle, can incur a performance hitfalseboolean
randomize-velocityif true, re-randomize velocity when re-spawning a particle, can incur a performance hitfalseboolean
relativeworld relative particles move relative to the world, while local particles move relative to the emitter (i.e. if the emitter moves, all particles move with it)'local''local', 'world'
rotationrotation in degrees0number
rotation-axislocal axis when using rotation{x: 0, y: 0, z: 0}vec3
rotation-axis-spreadvariance in the axis of rotation{x: 0, y: 0, z: 0}vec3
rotation-spreadrotation variance in degrees0number
rotation-staticif true, the particles are fixed at their initial rotation value. if false, the particle will rotate from 0 to the 'rotation' valuefalseboolean
sizearray of sizes over the particle's lifetime, max 4 elements1array
size-spreadspread in size over the particle's lifetime, max 4 elements0array
texturetexture to be used for each particle, may be a spritesheetmap
texture-frame-countnumber of frames in the spritesheet, negative numbers default to textureFrames.x * textureFrames.y-1int
texture-frame-loopnumber of times the spritesheet should be looped over the lifetime of a particle1int
texture-framesx and y frames for a spritesheet. each particle will transition through every frame of the spritesheet over its lifetime (see textureFramesLoop){x: 1, y: 1}vec2
use-transparencyshould the particles be rendered with transparency?trueboolean
velocityfor sphere and disc distributions, only the x axis is used{x: 0, y: 0, z: 0}vec3
velocity-distributiondistribution of particle velocities, for disc and sphere, only the x component will be used. if set to NONE use the 'distribution' attribute for velocityDistribution'NONE''NONE', 'BOX', 'SPHERE', 'DISC'
velocity-spreadvariance for the velocity{x: 0, y: 0, z: 0}vec3
wiggleextra distance the particle moves over its lifetime0number
wiggle-spread+- spread for the wiggle attribute0number

Limitations

When using the disc or sphere distributions for velocity or acceleration, setting the radius to 0, will also disable the velocity and acceleration

Enabling randomizePosition on sphere or disc distributions breaks the velocity and acceleration behavior

Having an activeMultiplier greater than 1 provides a burst of particles, however the emitter will gradually get out of sync and emit more and more particles between each burst

On Firefox when using a single particle with an infinite duration emitter, the particle may disappear

If the duration is the same as maxAge, then particles may be emitted at the end of the duration

If a texture is not provided then a 1x1 white texture will be used

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago