Skip to content
This repository was archived by the owner on May 26, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions dist/particles.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ var Particles = (function(window, document) {

for(var i = storage.length; i--;) {
var particle = storage[i];

if (showParticles) {
particle._draw();
}
Expand Down Expand Up @@ -416,12 +416,18 @@ var Particles = (function(window, document) {
* @return {object}
*/
Plugin.prototype._hex2rgb = function(hex) {
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
var result = hex.replace('#', '');

result = result.match(new RegExp('(.{'+result.length/3+'})', 'g'));

for(var i = 0; i < result.length; i++) {
result[i] = parseInt(result[i].length === 1 ? result[i]+result[i]:result[i], 16);
}

return result ? {
r: parseInt(result[1], 16),
g: parseInt(result[2], 16),
b: parseInt(result[3], 16)
r: result[0],
g: result[1],
b: result[2]
} : null;
};

Expand Down Expand Up @@ -485,7 +491,7 @@ var Particles = (function(window, document) {
*/
Particle.prototype._updateCoordinates = function(parentWidth, parentHeight) {
var _ = this,

x = _.x + this.vx,
y = _.y + this.vy,
radius = _.radius;
Expand Down Expand Up @@ -514,7 +520,7 @@ var Particles = (function(window, document) {
window.requestAnimFrame = (function() {
var _ = this,
requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;

if (requestAnimationFrame) {
return requestAnimationFrame;
}
Expand Down
2 changes: 1 addition & 1 deletion dist/particles.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 13 additions & 7 deletions src/particles.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ var Particles = (function(window, document) {

for(var i = storage.length; i--;) {
var particle = storage[i];

if (showParticles) {
particle._draw();
}
Expand Down Expand Up @@ -416,12 +416,18 @@ var Particles = (function(window, document) {
* @return {object}
*/
Plugin.prototype._hex2rgb = function(hex) {
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
var result = hex.replace('#', '');

result = result.match(new RegExp('(.{'+result.length/3+'})', 'g'));

for(var i = 0; i < result.length; i++) {
result[i] = parseInt(result[i].length === 1 ? result[i]+result[i]:result[i], 16);
}

return result ? {
r: parseInt(result[1], 16),
g: parseInt(result[2], 16),
b: parseInt(result[3], 16)
r: result[0],
g: result[1],
b: result[2]
} : null;
};

Expand Down Expand Up @@ -485,7 +491,7 @@ var Particles = (function(window, document) {
*/
Particle.prototype._updateCoordinates = function(parentWidth, parentHeight) {
var _ = this,

x = _.x + this.vx,
y = _.y + this.vy,
radius = _.radius;
Expand Down Expand Up @@ -514,7 +520,7 @@ var Particles = (function(window, document) {
window.requestAnimFrame = (function() {
var _ = this,
requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;

if (requestAnimationFrame) {
return requestAnimationFrame;
}
Expand Down