Organic lines of staring-atness
How do I make an organic lines of staring-atness?
I'm really proud of this simple result, I also really enjoyed coding it right before school! Hope you enjoy it! The parameters are on line 5,6,7,8 if you want to fiddle around with it. What is a organic lines of staring-atness? How do you make a organic lines of staring-atness? This script and codes were developed by Matei Copot on 12 June 2022, Sunday.
Organic lines of staring-atness - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>organic lines of staring-atness</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! */ canvas{ position:absolute; top:0; left:0; background-color:black;
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <canvas id=c></canvas> <script src="js/index.js"></script>
</body>
</html>
Organic lines of staring-atness - Script Codes CSS Codes
canvas{ position:absolute; top:0; left:0; background-color:black;
}
Organic lines of staring-atness - Script Codes JS Codes
var w = c.width = window.innerWidth, h = c.height = window.innerHeight, ctx = c.getContext('2d'), count = (w*h/3000)|0, speed = 4, range = 80, lineAlpha = .05, particles = [], huePart = 360/count;
for(var i = 0; i < count; ++i) particles.push(new Particle((huePart*i)|0));
function Particle(hue){ this.x = Math.random()*w; this.y = Math.random()*h; this.vx = (Math.random()-.5)*speed; this.vy = (Math.random()-.5)*speed; this.hue = hue;
}
Particle.prototype.update = function(){ this.x += this.vx; this.y += this.vy; if(this.x < 0 || this.x > w) this.vx *= -1; if(this.y < 0 || this.y > h) this.vy *= -1;
}
function checkDist(a, b, dist){ var x = a.x - b.x, y = a.y - b.y; return x*x + y*y <= dist*dist;
}
function anim(){ window.requestAnimationFrame(anim); ctx.fillStyle = 'rgba(0, 0, 0, .05)'; ctx.fillRect(0, 0, w, h); for(var i = 0; i < particles.length; ++i){ var p1 = particles[i]; p1.update(); for(var j = i+1; j < particles.length; ++j){ var p2 = particles[j]; if(checkDist(p1, p2, range)){ ctx.strokeStyle = 'hsla(hue, 80%, 50%, alp)' .replace('hue', ((p1.hue + p2.hue + 3)/2) % 360) .replace('alp', lineAlpha); ctx.beginPath(); ctx.moveTo(p1.x, p1.y); ctx.lineTo(p2.x, p2.y); ctx.stroke(); } } }
}
anim();
Developer | Matei Copot |
Username | towc |
Uploaded | June 12, 2022 |
Rating | 4.5 |
Size | 2,415 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 |
Experiment with basic 3d on 2d canvas | 2,577 Kb |
Neon hexagon-forming particles | 2,821 Kb |
Binary spiral | 2,370 Kb |
Hexagonical retro tiles | 2,901 Kb |
Plasma background | 3,338 Kb |
Progression of ideas through willpower and motivation | 2,968 Kb |
Neural Network visualization | 4,562 Kb |
Rainbow Firestorm recreation | 3,567 Kb |
Springing Particles | 2,493 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 |
Simple CSS loader. | Cabrera | 2,574 Kb |
Another brick in the wall | Fivera | 1,955 Kb |
AngularJS Datalist Directive | M-e-conroy | 2,366 Kb |
CSS Infinite 360 | APinix | 5,564 Kb |
Rainbow Drops | Csbarnes | 2,365 Kb |
Wikipedia Viewer | Thomasvaeth | 2,549 Kb |
Webkit decolorize | Fivera | 1,675 Kb |
Scroll to view if element partially out of view port height | ChrisMaki | 2,104 Kb |
Very Simple Slider | Doodlemarks | 2,682 Kb |
SVG Hover Animations | Kjbrum | 10,557 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!