Git Product home page Git Product logo

particle-cloud's Introduction

Particle Cloud

This is a "semi-orbital" particle cloud animation that I've created around three years ago (2010) but have now updated and optimized to use requestAnimationFrame etc.. It's a Canvas based animation that uses I wrote from scratch without using any libraries (except jQuery, but it can be easilly rewritten to not require it).

The particles are randomly generated during the initialization stage (colour, size etc.) and then are non-randomly animated using quasi-physics that actually aren't similar to anything in real life.

Quasi-physics

The idea behind the "physics" over here is creating a "magnetic well" that attracts particles, and then repels them once they reach the "well". The particles accelerate until they reach their maximum velocity or until they reach the well. After reaching the well, they start deaccelerating based on the value of detraction set in the script. The particles do not travel to the well using a straight line - their path is actually curved in order to achieve a more interesting effect.

The smaller particles travel slower which creates an illusion of 3D.

Using the script

You can initialize the script by calling the following:

 ParticleCloud.init(canvasID, numberOfParticles, beforeRenderCallback, afterRenderCallback)

canvasId is a string representing the id of the canvas in your HTML file, the rest of the arguments are optional and are self-explainatory. The script expects the HTML file to only have a single canvas element as it resizes it to fill the browser window, however this behaviour can be easily changed.

Demo

By default the particles will follow your cursor (or finger on touch-screen devices). You can click to repel the particles.

Demo with 200 particles

Demo with 500 particles

Demo with 1000 particles

Demo with 2000 particles

Demo with 10000 particles (warning, can be really slow!)

Licence

MIT

particle-cloud's People

Contributors

maciekbaron avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

maksims

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.