smoke-effect

1.1.1 • Public • Published

Smoke Effect

Realistic smoke effect using html canvas.

Example

(Note that the used example is highly degraded when using GIF format. The real effect is nearly perfect.)

https://github.com/elisiondesign/smoke-effect/raw/master/example/Feb-26-2019%2009-52-17.gif

Usage

<canvas id="canvas"></canvas>
    var canvas = document.getElementById("canvas");
    var context = canvas.getContext("2d");
    canvas.width = 1500;
    canvas.height = 1000;
    var smoke = new Smoke(context, [80, 80, 80]); // context canvas, smoke color
    smoke.start();
    smoke.step(500);
    addSmoke(smoke);
  
  // Make run smoke run indefinitely
    function addSmoke() {
      smoke.addSmoke(400, 500, 2);
      smoke.addSmoke(600, 500, 3);
      setTimeout(() => {
        addSmoke();
      }, 1000);
    }

/smoke-effect/

    Package Sidebar

    Install

    npm i smoke-effect

    Weekly Downloads

    2

    Version

    1.1.1

    License

    ISC

    Unpacked Size

    132 kB

    Total Files

    6

    Last publish

    Collaborators

    • xbilek18
    • xcharvat