Rainbow rain
How do I make an rainbow rain?
What is a rainbow rain? How do you make a rainbow rain? This script and codes were developed by Matei Copot on 12 June 2022, Sunday.
Rainbow rain - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>rainbow rain</title> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ body { background-color:black;
}
#c { opacity:.8;
}
canvas { position:absolute; top:0; left:0;
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <canvas id=c></canvas>
<canvas id=bg></canvas> <script src="js/index.js"></script>
</body>
</html>
Rainbow rain - Script Codes CSS Codes
body { background-color:black;
}
#c { opacity:.8;
}
canvas { position:absolute; top:0; left:0;
}
Rainbow rain - Script Codes JS Codes
//initial
var w = c.width = window.innerWidth, h = c.height = window.innerHeight, ctx = c.getContext('2d'), //parameters total = w, accelleration = .05, //afterinitial calculations size = w/total, occupation = w/total, repaintColor = 'rgba(0, 0, 0, .04)' colors = [], dots = [], dotsVel = [];
//setting the colors' hue
//and y level for all dots
var portion = 360/total;
for(var i = 0; i < total; ++i){ colors[i] = portion * i; dots[i] = h; dotsVel[i] = 10;
}
function anim(){ window.requestAnimationFrame(anim); ctx.fillStyle = repaintColor; ctx.fillRect(0, 0, w, h); for(var i = 0; i < total; ++i){ var currentY = dots[i] - 1; dots[i] += dotsVel[i] += accelleration; ctx.fillStyle = 'hsl('+ colors[i] + ', 80%, 50%)'; ctx.fillRect(occupation * i, currentY, size, dotsVel[i] + 1); if(dots[i] > h && Math.random() < .01){ dots[i] = dotsVel[i] = 0; } }
}
anim();
Developer | Matei Copot |
Username | towc |
Uploaded | June 12, 2022 |
Rating | 4.5 |
Size | 2,171 Kb |
Views | 42,504 |
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 |
Eiffel Tower | 3,692 Kb |
Random curve-pathed particles of rainbowness | 2,576 Kb |
Turret of Order | 4,000 Kb |
Rainbow transfer | 2,566 Kb |
Invasion of creepy crawly rainbow fireflies | 3,094 Kb |
Organic lines of staring-atness | 2,415 Kb |
Wavy 3d rainbow lattice | 2,951 Kb |
Experiment with basic 3d on 2d canvas | 2,577 Kb |
Rotating tunnel of rainbowness | 2,885 Kb |
Superimpositional garden | 3,307 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 |
Mobile Nav Menu | AliKlein | 4,745 Kb |
CSS3 Selectables with information rollover | Jasonmayes | 9,565 Kb |
TestTube CSS | EZPK | 2,710 Kb |
Pink expansion tunnel | Vez | 1,738 Kb |
Animated Donut Chart | Jplhomer | 3,808 Kb |
Minimal Material Design Form Input | Koenigsegg1 | 3,076 Kb |
Pagepilling.js | Blossk | 6,554 Kb |
Bootstrap Responsive Menu Drawer | JesseGlacken | 3,777 Kb |
Octopus Bar iPad App Interactions | Davidkpiano | 6,735 Kb |
Login-ng-modal | Heedoo | 3,566 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!