Electric worm
How do I make an electric worm?
Random math stuff using waves and more waves. Feel free to use as you wish. Doubts? just message/post me. :). What is a electric worm? How do you make a electric worm? This script and codes were developed by Jeff Ibacache on 23 June 2022, Thursday.
Electric worm - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Electric worm</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <canvas id="canvas"></canvas> <script src="js/index.js"></script>
</body>
</html>
Electric worm - Script Codes CSS Codes
body { margin: 0; padding: 0; background: #FFF;
}; canvas { position: absolute; width: 100%; height: 100%;
}
Electric worm - Script Codes JS Codes
var canvas;
var context;
var screenWidth;
var screenHeight;
var doublePI = Math.PI * 2;
var step = 30;
var offset = 0;
window.onload = function()
{ canvas = document.getElementById('canvas'); context = canvas.getContext('2d'); window.onresize = function() { screenWidth = window.innerWidth; screenHeight = window.innerHeight; canvas.width = screenWidth; canvas.height = screenHeight; }; window.onresize(); loop();
};
window.getAnimationFrame =
window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function(callback)
{ window.setTimeout(callback, 16.6);
};
function loop()
{ context.fillStyle = '#282828'; context.fillRect(0, 0, screenWidth, screenHeight); render(); step += 0.1; offset += Math.sin(step * 0.01) * 0.04; getAnimationFrame(loop);
}
function render()
{ if(Math.random() > 0.05) drawWave(180, 160, 15, false, 0); if(Math.random() > 0.8) drawWave(180, 160, 1, false, 8);
}
function drawWave(sw, sh, lineWidth, fill, randomFactor)
{ var i = 22; var length = 64; context.beginPath(); context.lineWidth = lineWidth; context.strokeStyle = '#FFF'; context.fillStyle = '#FFF'; context.lineJoin = "round"; context.lineCap = "round"; for(i; i <= length; ++i) { var norm = (i / length); var angle = doublePI * norm; var wave = norm * (Math.cos(step * 0.1) * 48 + 64); var x = Math.cos(angle + (Math.PI / 2) + offset) * (Math.cos(step * 0.6) * 20 + sw) + Math.cos(wave + step + offset) * (Math.sin(step + offset) * 8) + Math.cos(wave * 0.5 + step + offset) * 12 + (1 - (Math.random() * 2) * randomFactor); var y = Math.sin(angle + (Math.PI / 2) + offset) * (Math.sin(step) * 20 + sh) + Math.sin(wave + step + offset) * (Math.cos(step + offset) * 8) + Math.sin(wave * 0.5 + step + offset) * 16 + (1 - (Math.random() * 2) * randomFactor); if(i === 0) context.moveTo(x + (screenWidth >> 1), y + (screenHeight >> 1)); else context.lineTo(x + (screenWidth >> 1), y + (screenHeight >> 1)); if(!fill) context.stroke(); else context.fill(); } context.closePath();
}

Developer | Jeff Ibacache |
Username | jeffibacache |
Uploaded | June 23, 2022 |
Rating | 4 |
Size | 2,377 Kb |
Views | 38,437 |
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 |
A Pen by Jeff Ibacache | 2,359 Kb |
Wave Physics Playground | 3,267 Kb |
Fake 3D Blob | 2,823 Kb |
Pseudo 3D Particles | 2,548 Kb |
Stardust | 2,629 Kb |
Wave | 1,997 Kb |
Majesty of waves | 3,174 Kb |
Majesty of waves II | 3,342 Kb |
Astral Spiral Playground | 2,764 Kb |
Bezier Fun | 3,319 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 |
Arrow Navigation | Hinducows | 1,973 Kb |
A Pen by Theun | Tjoen | 6,152 Kb |
Fun animations with CSS3 | Minimalmonkey | 2,360 Kb |
Scroll effect with text with help from Skrollr | Luxonglassing | 2,935 Kb |
CSS Parent Selector | Tomhodgins | 2,143 Kb |
Off Canvas | Mariamarica | 1,870 Kb |
Animated skewed panes | NyX | 4,462 Kb |
Ball physics | Blackkbot | 3,874 Kb |
Ocean | Gordonnl | 2,817 Kb |
A Pen by Alexandru Pora | Axpro | 1,615 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!