Circuitry

Developer
Size
2,541 Kb
Views
40,480

How do I make an circuitry?

What is a circuitry? How do you make a circuitry? This script and codes were developed by Aitor on 16 September 2022, Friday.

Circuitry Previews

Circuitry - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Circuitry</title> <link rel="stylesheet" href="css/style.css">
</head>
<body>
<canvas></canvas> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Circuitry - Script Codes CSS Codes

html, body { margin: 0; padding: 0; background: #000; width: 100%; height: 100%; overflow: hidden;
}

Circuitry - Script Codes JS Codes

var $canvas = $('canvas'), canvas = $canvas.get(0), context = canvas.getContext('2d'), $window = $(window), mouseX = 0, mouseY = 0, tileX = 64, tileY = 48, size = 20, lines = [];
$window .on('resize', function(e){ $canvas .attr('width', $window.width()) .attr('height', $window.height()); }) .trigger('resize') .on('mousemove', function(e){ mouseX = e.clientX; mouseY = e.clientY; });
function loop() { context.clearRect(0,0,canvas.width,canvas.height); var w = canvas.width / tileX, h = canvas.height / tileY; if (lines.length < 20) { var r = Math.random() * Math.PI * 2; lines.unshift({ x: Math.round(mouseX / w) + Math.round((Math.cos(r) * canvas.width)), y: Math.round(mouseY / h) + Math.round((Math.sin(r) * canvas.height)), old: [] }); } context.fillStyle = '#fff'; for (var y = 0; y < tileY; y++) { for (var x = 0; x < tileX; x++) { var dx = (x * w) - mouseX; var dy = (y * h) - mouseY; context.globalAlpha = size * (1 / Math.sqrt(dx * dx + dy * dy)) + (Math.random() * 0.2); context.fillRect(x * w, y * h, 1, 1); } } context.strokeStyle = '#fff'; for (var i = 0; i < lines.length; i++) { var line = lines[i], dx = (mouseX - line.x), dy = (mouseY - line.y), d = Math.sqrt(dx * dx + dy * dy); line.x += (dx) * 0.1; line.y += (dy) * 0.1; line.x = Math.round(line.x / w) * w; line.y = Math.round(line.y / h) * h; if (d < 100) { var r = Math.random() * Math.PI * 2; line.x = Math.round(mouseX / w) + (Math.cos(r) * canvas.width); line.y = Math.round(mouseY / h) + (Math.sin(r) * canvas.height); while (line.old.length > 0) { line.old.pop(); } } if (line.old.length >= 20) { line.old.pop(); } line.old.unshift({ x: line.x, y: line.y }); context.beginPath(); for (var j = 1; j < line.old.length; j++) { var lineOld = line.old[j]; context.globalAlpha = (1 - (i / line.old.length)) * 0.5; if (j === 1) { context.moveTo(lineOld.x, lineOld.y); } else { context.lineTo(lineOld.x, lineOld.y); } if (j % 2 === 0) { context.stroke(); } } } requestAnimationFrame(loop);
}
loop();
Circuitry - Script Codes
Circuitry - Script Codes
Home Page Home
Developer Aitor
Username AzazelN28
Uploaded September 16, 2022
Rating 4
Size 2,541 Kb
Views 40,480
Do you need developer help for Circuitry?

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!

Aitor (AzazelN28) Script Codes
Create amazing video scripts with AI!

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!