Giter Club home page Giter Club logo

html-particle-engine's Introduction

Particle Emiting Engine for Canvas

Versionnumber 0.4.1 (2016-08-21) Beta

(Documentation last update 2016-08-21 21:30)

Particle Emiting Engine with html5 canvas
Screenshot four particle-emitters
Small demo

Features

  • Emits particles
  • particle renderer Customizable
  • paritcle fades on lifespan ending
  • emit multiple particles at the same time
  • emitter can emit randomized particles
  • calculate framerate
    • toggle framerate display
  • "gravity" and "ambient Drag"
  • paritcle bounce of walls top, right, bottom, left
  • onBorderCollision Event

WIP

Roadmap / Future Features

  • emit adaptaions
    • emit automatic particles in specified time interval
    • emit only specified amount of particels in specified time interval
  • particle render rotation

Known Bugs

Usage

 //Initialise Engine
 Engine.init({
        context: context,
        left: 0,
        top: 0,
        right: canvas.width,
        bottom: canvas.height
  });

  // Add ParticleEmiter 
  var particleEmitter = {
        emitedParticles: [],
        emitPoint: {x: 50, y: 100},
        emitVectors: [{x: 1, y: 1}, {x: -1, y: 1}, {x: -1, y: 1}],
        emitSpeed: 1,
        particleMaxLifeSpan: 1000,
        particleSize: size,
        particleColor: {r: 0, g: 0, b: 0, a: 1},
        shouldRandomizeEmitVector: true
    };
  Engine.addObjectToRender(particleEmitter);

  // Emit Particle
  ParticleEmitterRunner.emit(particleEmitter);

SourceControl Link & Information

https://github.com/akumagamo/html-particle-engine.git

Documentation

File / Folder Structure

 +-+- html-particle-engine
   +-+- documents
   | +- jsdoc  (output directory for jsdoc script)
   +-+- logs (logfile default folder)
   +-+- readme
   | +- screenshot_01.png
   +-+- source
   | +- css
   | +-+- style.css
   | +- js
   | +-+- script.js
   | +- index.html
   +- readme.md (this document)
   +- LICENSE

Options for the Engine init

  • context: canvas context
  • left: Draw left limit
  • top: Draw top limit
  • right: Draw right limit
  • bottom: Draw bottom limit

Options for the ParticleEmitter

  • borders: Border where the particles collided
  • emitedParticles: Array for storing emited particles
  • emitPoint: Point from where the particles will be emitted
  • emitVectors: Array with the Vectors for emiting, will be ignored if shouldRandomizeEmitVector is set to true
  • emitSpeed: Speed of emitted particle
  • particleMaxLifeSpan: Lifespan of created particles in ms
  • particleSize: Particle Size
  • particleColor: RGBA color Object
  • renderer: Custom Render function for particles
  • onBorderCollision: Event Listener function, called on collision
  • shouldRandomizeEmitVector: property if the EmitVector should be randomizied at every emit

html-particle-engine's People

Contributors

akumagamo avatar

Watchers

Joe Stone avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.