Ribbons
How do I make an ribbons?
What is a ribbons? How do you make a ribbons? This script and codes were developed by Ben Matthews on 10 September 2022, Saturday.
Ribbons - Script Codes HTML Codes
<!DOCTYPE html>
<html class="https://github.com/processing/p5.js/releases/download/0.5.6/p5.min.js">
<head> <meta charset="UTF-8"> <title>Ribbons</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <script src='https://github.com/processing/p5.js/releases/download/0.5.6/p5.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Ribbons - Script Codes CSS Codes
* { margin:0; padding:0; }
html, body { width:100%; height:100%; }
canvas { display:block; }
Ribbons - Script Codes JS Codes
window.addEventListener('resize', resize, false);
var hues = [ 0, 50, 220
];
function Ribbon(){ this.x = random()*width; this.y = random()*height; this.width = random()*20 + 20; this.hue = hues[floor(random()*hues.length)]; this.balance = random()*50 + 50; this.speed = random()*3 + 3; this.angle = floor(random()*8)*45; this.height = 0;
}
Ribbon.prototype.tick = function(){ this.height += this.speed; if (((height*2 - this.height)/height*2) < 0){ this.x = random()*width; this.y = random()*height; this.width = random()*20 + 20; this.hue = hues[floor(random()*hues.length)]; this.balance = random()*50 + 50; this.speed = random()*3 + 3; this.angle = floor(random()*8)*45; this.height = 0; }
}
Ribbon.prototype.render = function(){ translate(this.x, this.y); rotate(this.angle); noStroke(); var alpha = ((height*2 - this.height)/height*2); fill(this.hue, 80, this.balance, alpha); rect(0, 0, this.width, this.height); fill(this.hue, 100, this.balance + 10, alpha); rect(0, 0, this.width/2, this.height); resetMatrix();
}
var ribbons;
function setup(){ angleMode(DEGREES); rectMode(CENTER); colorMode(HSB, 360, 100, 100); createCanvas(); resize(); ribbons = []; for (var i = 0; i < 100; i++){ ribbons.push(new Ribbon()); }
}
function draw(){ background(0); if (ribbons == undefined) return; for (var i = 0; i < ribbons.length; i++){ ribbons[i].tick(); ribbons[i].render(); }
}
function resize(){ resizeCanvas(window.innerWidth, window.innerHeight);
}
Developer | Ben Matthews |
Username | tsuhre |
Uploaded | September 10, 2022 |
Rating | 3.5 |
Size | 2,140 Kb |
Views | 36,432 |
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 |
Changing Terrain Experiment | 2,337 Kb |
Chaos Tracers | 2,553 Kb |
Circuit Board Generator | 3,100 Kb |
Random Chess Game | 3,330 Kb |
Constellations | 2,961 Kb |
Diffusion Limited Aggregation | 3,361 Kb |
Axial | 4,511 Kb |
Circular Ogee Tiling | 3,106 Kb |
Corny e-Valentine | 2,587 Kb |
Voronoi Pursuit Curves | 4,234 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 |
Minimelephant | Smashlee | 2,507 Kb |
A Pen by Theun | Tjoen | 6,152 Kb |
Update CSS Variables with JS | Wesbos | 2,335 Kb |
CSS3 Media Queries demo | Machal | 1,824 Kb |
Transitioning application screens with semantically named classes | Djgrant | 3,697 Kb |
A Pen by Moeid Saleem | Moeidsaleem | 1,862 Kb |
React Vote Component | Souporserious | 5,465 Kb |
Price | Catcode | 2,623 Kb |
Sass Radar | Jlong | 6,887 Kb |
A Pen by Brendan Skousen | Bskousen | 2,954 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!