%canvas#c
View Compiled
html, body {
height: 100%;
}
body {
background: black;
overflow: hidden;
}
canvas {
max-width: 100%;
}
View Compiled
window.requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;
var
canvas = document.getElementById("c"),
ctx = canvas.getContext("2d"),
w = canvas.width = window.innerWidth,
h = canvas.height = window.innerHeight,
logoParticles = [],
particleIndex = 0,
logo = new Image(),
hue = 0;
function Particle(x, y){
this.origX = this.x = x;
this.origY = this.y = y;
this.color = "white";
this.maxLife = this.random(20);
this.life = 0;
this.vx = this.random(-1, 1);
this.vy = this.random(-1, 1);
this.grav = .04;
this.index = particleIndex;
logoParticles[particleIndex] = this;
particleIndex++;
}
Particle.prototype = {
constructor: Particle,
draw: function(){
ctx.fillStyle = this.color;
ctx.fillRect(this.x, this.y, 2, 2);
this.update();
},
update: function(){
if(this.life >= this.maxLife){
logoParticles[this.index].reset();
}
this.x += this.vx;
this.y += this.vy;
this.vy += this.grav;
this.life++;
},
reset: function(){
this.x = this.origX;
this.y = this.origY;
this.life = 0;
this.color = "hsl("+hue+", 100%, 50%)";
this.vx = this.random(-1, 1);
this.vy = this.random(-1, 1);
},
random: function(){
var
min = arguments.length == 1 ? 0 : arguments[0],
max = arguments.length == 1 ? arguments[0] : arguments[1];
return Math.random() * (max - min) + min;
}
};
logo.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAtMAAACJCAMAAADZoES7AAAC91BMVEUAAAAAAAB/f3+qqqq/v7/MzMzU1NTb29vf39/j4+Pl5eXo6Ojq6urr6+vt7e3u7u7v7+/w8PDx8fHy8vLy8vLz8/Pz8/P09PT09PT19fX19fX19fX29vb29vb29vb39/f39/f39/f39/f4+Pj4+Pj4+Pj4+Pj4+Pj5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+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jYw/tRHRodGQkza7tC1i0H98IAUsC6b62WDkppPXWTDSrODogojyhtxs2e6NKTBrFDrWvUCTBWsljrbhkicVtJsA824aP7E/YpBa+NuTbHZlq3/MzpblU802nc+OdL35kfZ4ut01bfnvtuyvqq6u/HTzm08+mJMECw3Yzz+Ymm2ad8z0jt7weFTjX8xO9YkRbNOcxwHUP+yD0zwe+anWN+2ukfZ4/I82UriTI/VNcx4EUD8rDh6PsgZ8xk71cWpX9v/t1D9ugmAcAFASOEjbrbQH6gna6u6fq6EmTspxYIDtG1yMDhLC+vvy3iHeRNIfBdGo+ili0vDdpsVOEZKGaj8uTHodJGn4ahcl/V5ARlX3sZKG+ppmHaMlDdVupup+JWniVx0/aai2Q5rQ/YdNGupLenGQNMGrzjppVN3ETxrKzaPq7i+LpOHzXnXzVuQByt92HM4/OSQNAAAAAMANMjDweCEAUusAAAAASUVORK5CYII=";
logo.onload = function(){
var
posX = (w - this.width)/2,
posY = (h - this.height)/2;
ctx.drawImage(this, posX, posY);
var
imgData = ctx.getImageData(0, 0, w, h),
pixels = imgData.data;
for(var y = 0; y < imgData.height; y+=3) {
for(var x = 0; x < imgData.width; x+=3) {
var alpha = pixels[((imgData.width * y) + x) * 4 + 3];
if(alpha > 0){
logoParticles.push(new Particle(x, y));
}
}
}
setTimeout(function(){
animate();
}, 800);
};
function animate(){
ctx.fillStyle = "rgba(0,0,0,.1)";
ctx.fillRect(0,0,w,h);
for(var i in logoParticles){
logoParticles[i].draw();
}
hue += 1;
window.requestAnimationFrame(animate);
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.