GithubHelp home page GithubHelp logo

hhy5277 / proton Goto Github PK

View Code? Open in Web Editor NEW

This project forked from drawcall/proton

0.0 2.0 0.0 4.93 MB

A particle engine for javascript

Home Page: http://a-jie.github.io/Proton/

JavaScript 81.01% HTML 18.99%

proton's Introduction

Proton

See the detailed documentation please visit here

Proton is a lightweight and powerful javascript particle engine. With it you can easily create countless cool effects.

Check out examples at: http://a-jie.github.io/Proton/. Check out the tutorial at: https://qiita.com/matsu7089/items/dcb7d326e4ec1340eba6

Features

  • Seven kinds of renderers
    • canvas - CanvasRenderer
    • dom - DomRenderer
    • webgl - WebGLRenderer
    • pixel - PixelRenderer
    • easeljs - EaselRenderer
    • pixi.js - PixiRenderer
    • custom - CustomRenderer
  • Create cool effects like the demo of 71squared's ParticleDesigner in 10 lines of code.
  • Integratable into any game engine.
  • Veriety of behaviors which can simulate many different physical effects.
  • Three kinds of emitters and can be easily expanded.
  • The 3D version of the proton engine is here https://a-jie.github.io/three.proton/

Installation

Install using npm

anix

npm install proton-js --save
... 
import Proton from 'proton-js';

OR include in html

<script type="text/javascript" src="js/proton.min.js"></script> 

Usage

var proton = new Proton();
var emitter = new Proton.Emitter();

//set Rate
emitter.rate = new Proton.Rate(Proton.getSpan(10, 20), 0.1);

//add Initialize
emitter.addInitialize(new Proton.Radius(1, 12));
emitter.addInitialize(new Proton.Life(2, 4));
emitter.addInitialize(new Proton.Velocity(3, Proton.getSpan(0, 360), 'polar'));

//add Behaviour
emitter.addBehaviour(new Proton.Color('ff0000', 'random'));
emitter.addBehaviour(new Proton.Alpha(1, 0));

//set emitter position
emitter.p.x = canvas.width / 2;
emitter.p.y = canvas.height / 2;
emitter.emit(5);

//add emitter to the proton
proton.addEmitter(emitter);

// add canvas renderer
var renderer = new Proton.CanvasRenderer(canvas);
proton.addRenderer(renderer);

//use Euler integration calculation is more accurate (default false)
Proton.USE_CLOCK = false or true;

Description

Proton.Span (or Proton.getSpan) is a very important concept of the Proton engine, it's everywhere. If you understand its usage, you can create almost any desired effect!

Proton has now been upgraded to the v3 version. Performance has been greatly improved and api also has some improvements. For more details, please check here.

Building

Node is a dependency, use terminal to install it with:

git clone git://github.com/a-jie/Proton.git
...
npm install
npm run build

and run example

npm start
//vist http://localhost:3001/example/

Changelog

Detailed changes for each release are documented in the release notes.

License

Proton is released under the MIT License. http://www.opensource.org/licenses/mit-license

proton's People

Contributors

aholla avatar frandias avatar holyzfy avatar hyandell avatar jpeer264 avatar rodritter avatar

Watchers

 avatar  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.