Fireflies
How do I make an fireflies?
Click canvas to reset.My collection with Brownian Motion based Pens: http://codepen.io/collection/XwMNBR/. What is a fireflies? How do you make a fireflies? This script and codes were developed by Johan Karlsson on 24 July 2022, Sunday.
Fireflies - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Fireflies</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <script src='https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.6/p5.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Fireflies - Script Codes CSS Codes
html, body { margin: 0;
}
canvas { display: block;
}
Fireflies - Script Codes JS Codes
"use strict";
/* Johan Karlsson (DonKarlssonSan)
*/
function Particle() { this.x = w / 2; this.y = h / 3; this.z = random(1);
}
Particle.prototype.move = function () { this.x += random(-particleStepMax, particleStepMax); this.y += random(-particleStepMax, particleStepMax); this.z += random(-0.01, 0.01); this.z = min(max(this.z, 0), 1);
};
Particle.prototype.draw = function () { ellipse(this.x, this.y, this.z * 7);
};
var particles;
var particleStepMax;
var w, h;
function setup() { cursor(HAND); particleStepMax = 2; w = windowWidth; h = windowHeight; initParticles(); createCanvas(w, h); noStroke(); fill("yellow"); background(0);
}
function draw() { background(0, 40); particles.forEach(function (p) { p.move(); p.draw(); });
}
function initParticles() { particles = []; for (var i = 0; i < 200; i++) { particles.push(new Particle()); }
}
function windowResized() { resizeCanvas(windowWidth, windowHeight);
}
function mouseClicked() { initParticles(); background(0);
}
Developer | Johan Karlsson |
Username | DonKarlssonSan |
Uploaded | July 24, 2022 |
Rating | 4 |
Size | 2,572 Kb |
Views | 64,768 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Portrait by Brownian Motion | 3,612 Kb |
The Birth of a Sine Wave | 2,607 Kb |
Brownian Gnats | 2,822 Kb |
Photobooth - Webcam with realtime CSS filters. | 4,390 Kb |
Brownian Motion | 2,549 Kb |
Text by Brownian Motion | 3,182 Kb |
Wayward Walker Worms | 3,123 Kb |
Random Fractal | 2,751 Kb |
Moss by Brownian Motion | 2,792 Kb |
Rotating Neon Curves | 3,770 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Twitch.tv API | Ryzokuken | 2,618 Kb |
CSSOff 2013 Submission | Codewunder | 14,766 Kb |
Multi-step GSAP animation | Acacheung | 2,668 Kb |
Single element checkbox | Ivijaygupta | 1,996 Kb |
Nice textured background | Hans | 2,659 Kb |
Resizable SASS Icons | Marianarlt | 7,611 Kb |
Canvas Orbital Trails v2 | Jackrugile | 3,421 Kb |
Slides-07-1 POSITION | Exhtml | 1,909 Kb |
Cool Page Split Effect | Anthonyadamski | 6,128 Kb |
A Pen by Adrien Clerbois | AClerbois | 6,501 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!