Git Product home page Git Product logo

particles.js's Introduction

particles.js's People

Contributors

extend1994 avatar henrikhasell avatar kitlawes avatar npmcdn-to-unpkg-bot avatar sourcesoft avatar yiziz 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  avatar  avatar  avatar

particles.js's Issues

NPM import not working

Doesn't seem to work when required or imported.

Seems like module.exports is missing and its relying on global variables instead?

Add option for particle bounce.

Right now particles are just deleted when they hit an edge of the canvas and this just doesnt look nice in all situations. There should be an option to allow for bouncing when hitting canvas bounds.

Use parentNode's width and height instead of window's sizes.

With a simple change the canvas can be limited to the container, even the body, when it's used as a background, e.g. in a header element.

canvas.width = canvas.parentNode.offsetWidth;
canvas.height = canvas.parentNode.offsetHeight;

If it's ok for you, I can try to submit a PR.

Particles.init not returning anything

I'm trying to pause animation with

  var particles = Particles.init({
         // options
       });
  particles.pauseAnimation();

however particles is undefined
the partcicles keep moving/animating

Pause animation or canvas feature

I'm using this library to render the background of a banner section. While I enjoy having the animated background, I'd like it to stop if I scroll past it or if the user is not actively engaging with that part of the page (i.e. mouse being over it). This should help save the user quite a bit of battery and computation power. Is there a way to stop the animation? I was considering taking an image of the canvas and swapping it, but it'd be easier if stopping the animation was a feature.

Potential Issues in Edge?

I used this in a recent client project, and they sent me screenshots of some wonkiness in Edge? maybe something worth checking out?

JanssenLLC_dots_network_vs_Rekognition_on_MS_Edge

Chrome and Safari Issues

Hi Marc! Thanks for the amazing plugin. In Chrome and Safari I get this error message in console, but in Firefox works fine.

TypeError: null is not an object (evaluating 'o.element.offsetParent.clientWidth')

I followed your example codes but I can't make it work.
I'm using Wordpress and Jquery

Color option

The color option is actually not optional (v2.0.1). An error appear if it's not defined: Uncaught TypeError: Cannot read property 'r' of null

Doesn't work on mobile

Hi!
Particle.JS doesn't work for me on mobile...
It works on the Desktop etc. and in the Dev Console at every width.

My Config:

// PARTICLE JS window.onload = function () { Particles.init({ selector: '.background', connectParticles: true, color: [ '#C8F7C5', '#1BBc9B', '#049372', '#D2527F' ], sizeVariations: 3, responsive: [ { breakpoint: 768, options: { maxParticles: 200, connectParticles: true, color: [ '#C8F7C5', '#1BBc9B', '#049372', '#D2527F' ], } }, { breakpoint: 425, options: { maxParticles: 100, connectParticles: true, color: [ '#C8F7C5', '#1BBc9B', '#049372', '#D2527F' ], } }, { breakpoint: 320, options: { maxParticles: 100, connectParticles: true, color: [ '#C8F7C5', '#1BBc9B', '#049372', '#D2527F' ], } } ] }); };

Responsive Breakpoints

responsive: [
  {
    breakpoint: 1024,
      settings: {
        color: '#000000'
        …
      }
  }, {
    breakpoint: 768,
      settings: {
        color: '#ff0000'
        …
      }
  }, {
    breakpoint: xxx,
      settings: {
        disable: true
        …
      }
  }
]

Change line size of connectParticles

There's a way to change de edge size variations, but there's no way do it with the connect lines.
Would be nice to add this config in this package.

IOS 12 Low FPS/Bad Performance!!

So I have Particles on my website for looks. I remeber updating to IOS 12 then going on my website and noticed it was extremely laggy. Only on mobile safari though. I tried multiple different browser on desktop they all seem to run smoothly. Anything running safari on ios 12 it tweaks.

I have done nothing really that special with it just initializing particles:
Particles.init({ selector: '.callout_canvas', connectParticles: true, maxParticles: 50, minDistance: 115, speed: 0.28, color: '#ffffff' });

Let me know what information you may need to help you fix this.

Set the canvas width and height using options

Current: The code inside particle is to create a canvas with 100% width and height.
Expected: Allow to use custom value for the canvas width and height.

I wanted to create a small-bottom-only particle background, this is why i need custom height values. I'd gladly work on it and create pull request if needed.

Particles squeezed on top on mobile devices

When I load the script on a mobile device with Google Chrome (I've not tested on other browsers) the particles are squeezed on top.

screen shot 2018-04-20 at 20 28 54

But after a change of resolution (without reloading the page):

screen shot 2018-04-20 at 20 30 59

The code in the page:

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>Title</title>
  </head>
  <body>

    <style>
    .background {
      position: absolute;
      display: block;
      top: 0;
      left: 0;
      z-index: -1;
      background-color: #222;
    }
    </style>

    <canvas class="background"></canvas>
    <script src="scripts/particles.min.js"></script>
    <script>
      window.onload = function() {
        Particles.init({
          maxParticles: 50,
          selector: '.background',
          color: '#ffffff',
          connectParticles: true,
        });
      };
    </script>
  </body>
</html>

Multiple particles

Dear, how can I apply the particles and more than 1 backgroud?
I tried in many ways, but this was the closest I could get, but only one executes. The other carries the particles, but they stand still.
I'm sorry for my english.

<canvas class="via-bg-bg-referencia">
<canvas class="via-bg-indicadores-sucesso">
window.onload=function() { var indicadores = Particles.init({ selector: '.via-bg-indicadores-sucesso', color: '#ef8a4e', maxParticles: 150, connectParticles: true, sizeVariations: 8, minDistance: 70, }); var referencia = Particles.init({ selector: '.via-bg-referencia', color: '#d3d9db', maxParticles: 150, connectParticles: true, sizeVariations: 8, minDistance: 70 }); };

How to destroy particles object

Is there a way to destroy the particles object? I can't see anything obvious in the code.

I have a single-page app, and switching between routes causes an error when it can't find the canvas object on the second page.

Thanks!

Create a Bower package

Publishing a Bower package seems easy and would allow to install this library as a dependency.

Performance issues in Chrome

Hi there,

I've recently noticed some performance issues with Particles.js in Chrome. I've tested in Firefox with no issues. In chrome the CPU % usage is incredibly high.

It occurs with your example page https://marcbruederlin.github.io/particles.js/. It's quite easy to notice as the particle movement speed is much slower in Chrome.

My details are as follows:
OSX El Capitan - 10.11.6
Chrome Version 65.0.3325.181 (Official Build) (64-bit)

Using A Fixed Position

I'm trying to use the particles.js background with a fixed position on the page so when scrolling it keeps the animation. Currently when I try to change the background position property to 'fixed' it breaks and states it cannot find clientWidth of null. If you'd like to see an example of what I am talking about please go to; http://brittanigongre.com/blockchain-demo/ and hit 'add-block' 3-4 times. Thank you for any help provided.

edit: I've also tried to add a div around the canvas element and set the div containing canvas to position: fixed, but the particles stop showing when I do that.

edit: I figured out the answer to my own question, I added a div around the canvas with a class name of 'particles' and added the following CSS:

.background {
background-color: #f9f9fb;
position: absolute;
display: block;
}

.particles {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: -1;
}

Bug: using CSS color names with connectParticles breaks the animation

Hello,

You might want to look into this. If you define a color array (or string) with CSS color names (eg: seagreen, blue, yellow, red, etc.), and enable connectParticles, the animation fails.
Particles.init({
selector: "#particles",
color: ["seagreen", "yellow", "blue"], // this will fail
connectParticles: true // if this is set to true (it works fine if set to false)
});

It has to do with hextorgb (which doesn't understand color names). Might want to look into fixing this or documenting it!

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.