Giter VIP home page Giter VIP logo

sparks.js's Introduction

Sparks.js

Simple 3D Javascript Particles Engine

Sparks.js is a library to help create 3D particles in Javascript.

Its simple, fast and fun to play with.

This is an ongoing project, so check out issue tracker, the wiki, the code and examples inside github.

Sparks.js welcomes feature and pull requests, so don't be shy to fork away!

It uses three.js for Vector classes and rendering and uses ease functions from tween.js.

####Demos Online####

####Examples Online####

####Articles####

####Upcoming features####

  • Text Particles
  • ShotCounter

sparks.js's People

Contributors

ericrius1 avatar idflood avatar jeromeetienne avatar vyncemontgomery avatar zz85 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sparks.js's Issues

particle editor ?

  • is there an editor to edit particles in a sparks.js compatible manner ?
  • it helps quite a bit non tech people to produce nice looking particle

Start particle at a point in time

I want the scene to starts with some particles already existing, just like when the particle system is already ran for few seconds.

Tried this code, but 100 interval doesn't seems to work. 1s does it but the user will see the initialization stage.

var i = setInterval(function(){ threexSparks._emitter.update(0.1); }, 1); 
setTimeout(function(i){
    clearInterval(i);
}, 100, i);

Ability to kill the emitter and better update management

I will do a pull request soon on these two subjects.

First subject is already covered and used, it allows to call kill() on the emitter that will stop the counter from creating more particles. The emitter will actually die when the last particle still there dies. Thus it kills "softly" and triggers a killed event when it's really over so you can detach it, or do whatever you need with it (like putting it in a pool to reuse it only by changing the counter and starting it again)

Second is because right now there is very little control over how the engine updates itself (it is base on timeouts)

I'd rather switch to a manual updating system such as in https://github.com/tweenjs/tween.js
so for instance you could flip-flop the updating or whatever related to performances, call it in requestAnimationFrame, and more important profile it easily.

Lastest Three.js lib

Hey was just checking out your example here
http://jabtunes.com/labs/particles/webgl_particles_shapes.html

For some reason when I update the urls for the js libraries to a relative urls pointing to my local copies of the Three.js it doesn't work ?
RequestAnimationFrame.js doesn't seem to be in the examples directory in the lastest version of the Three.js library

I was wondering if the example is out of date with the newest version of the Three.js Library?

Thanks

T

Colour classes

Hi there, i have just finished writing a quick guide to sparks (please have a read there afew questions),which i have to say is an excellent highly flexible particle system.

The only bit that i dont understand, is you have not got any colour manipulation objects amongst your Initializers and Actions, and when i look at your examples, they all work by changing the particle colour in code outside of sparks callbacks etc. This seems a bit counter intuitive to me since you have such a comprehensive array of objects already. Couldn't we have define some colour behaviour classes instead?

SPARKS.SpriteInitializer () which takes a new THREE.texture () as a parameter

SPARKS.ColorBlender() Action
which contains an array of colours and number between 0 an 1 to denote where the colour is.

just an idea!

"initialized" event ?

many examples contains a "initialized" event which is never called from Sparks.js

is that obsolete code ?

Performance Degradation

Hello again, i have been putting together a simple fire works demo:
http://www.nickfallon.net/3D/Fireworks.html

That continuosly fires fireworks, by adding and deleting them from an array. Unfortunately the performance degrades over time. I have checked my array is deleting and deleted the objects from the THREE scene, but to no avail. When deleting SPARS do i need to do anything specific other than automatic garbage collection?

I look at the SPARKS.Engine global, but actually my emitters don't seem to be added to it...

thanx

License

Line 9 of Sparks.js mentions that the code is licensed under the MIT license, however the license text doesn't appear anywhere in the repo or in the source code. Could you add the license so that I can correctly attribute usage of the library?

http://opensource.org/licenses/MIT

Thanks.

Can't run examples with three.js r51 and r52

I'd love to use this library, but it seems that it isn't fully compatible with the latest versions of three.js. I was wondering if an updated version of the library will come out - and if so - when?

no removeAction/removeInitializer ?

  • there is a addAction but no `removeAction``
  • there is a addInitilizer but no remove Initializer

So it is quite hard to remove stuff put in the stack.

A defect may need to be fixed

In Sparks.js line 113, its written that " this_.activities[i].update( this, time )".
I think it should be "this.activities[i].update( this, time )" with "" after "this".
Maybe this defect does not let the engine down, but I'm confused about what's the effect of "this._activities"๏ผŸ
Since I can't find any methods to add activities to emitter._activities in the Sparks.js .

All my best & Thax for this brilliant engine!

Splitting Sparks.js Source into Files

Usually I try to keeping as much code as possible in a js file if possible, but as more classes are being developed, there would be the need to split them into separate files and folders.

When that time comes, we could consider using UglifyJS or Google Closure Compiler for building the source files.

WebGL

HI , i have been having some trouble moving my sparks code from Canvas Renderer to WebGL renderer. All my particles disapear.

if ( render_gl === false ) {

                renderer = new THREE.CanvasRenderer();
                renderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
                container.appendChild( renderer.domElement );


            }
            else 
            {

                try 
                {

                    renderer = new THREE.WebGLRenderer();
                    renderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
                    renderer.domElement.style.position = "relative";
                    renderer.autoClear = false;
                    container.appendChild( renderer.domElement );

                    has_gl = 1;

                } catch (e) {
                    error.log('error');
                }
            }

Is there anything i need to configure to make them appear? I am using a ParticleBasicMaterial for example.

var material = new THREE.ParticleBasicMaterial( { size: 85, map: sprite, vertexColors: false ,transparent:false, blending: THREE.AdditiveBlending} );

I tried this material also:

var material = new THREE.ParticleCanvasMaterial( { map: sprite , program: SPARKS.CanvasShadersUtils.circles, blending:THREE.AdditiveBlending } );

Do i have to use a ParticleSystem rather than Particles ??

thanx
Nick

examples/CanvasShaders.js barely used ?

  • canvas examples uses various shapes for particles material.
  • Most examples got their own copy of this drawing code.
  • CanvasShaders.js would avoid this duplication but it is barely used

Why that ? historical reason ?

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.