Wave
How do I make an wave?
Simple wave using canvas and mathemagics.. What is a wave? How do you make a wave? This script and codes were developed by Jeff Ibacache on 12 June 2022, Sunday.
Wave - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Wave</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <canvas id="canvas"></canvas> <script src="js/index.js"></script>
</body>
</html>
Wave - Script Codes CSS Codes
* { margin: 0px;
}
canvas { display: block;
}
Wave - Script Codes JS Codes
var canvas;
var context;
var width;
var height;
var offset = 0;
var acc = 0;
var PI2 = Math.PI * 2;
var lineDisplacement = 30;
window.onload = function()
{ canvas = document.getElementById('canvas'); canvas.style.width = window.innerWidth + "px"; setTimeout(function() { canvas.style.height = window.innerHeight + "px";
}, 0); context = canvas.getContext('2d'); width = canvas.width = window.innerWidth; height = canvas.height = window.innerHeight; loop();
};
function loop()
{ drawSineWave(); requestAnimationFrame(loop);
}
function drawSineWave()
{ var i = 0; var length = PI2; context.fillStyle = "#F3F0D1"; context.fillRect(0, 0, width, height); context.strokeStyle = '#A9BD79'; context.beginPath(); context.moveTo(0, Math.sin(i + offset) * Math.cos(acc) + (height >> 1)); for(i; i < length; i += 0.2) { context.lineWidth = Math.sin(acc) * 40 + 60; context.lineTo((i / PI2) * width, Math.sin(i + offset) * lineDisplacement + (height >> 1)); context.stroke(); } offset += Math.cos(acc) * 0.08 + 0.14; acc += 0.01;
}
Developer | Jeff Ibacache |
Username | jeffibacache |
Uploaded | June 12, 2022 |
Rating | 3.5 |
Size | 1,997 Kb |
Views | 133,584 |
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 |
Electric worm | 2,377 Kb |
Pseudo 3D Particles | 2,548 Kb |
Playable Canvas Asteroids | 5,711 Kb |
Astral Spiral Playground | 2,764 Kb |
Wave Physics Playground | 3,267 Kb |
Pseudo Fluids | 3,266 Kb |
Bezier Fun | 3,319 Kb |
Majesty of waves II | 3,342 Kb |
Trippy Pac-Man | 2,552 Kb |
A Pen by Jeff Ibacache | 2,359 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 |
Draggable directive | YahyaKacem | 2,277 Kb |
Blog | Rottingroom | 1,430 Kb |
Polygon Dodecahedron in CSS | Vennsoh | 7,606 Kb |
Transitioning application screens with semantically named classes | Djgrant | 3,697 Kb |
Web SQL | Hoehoe | 1,983 Kb |
Flat buttons for Eliassen.com | Kdooley89 | 1,737 Kb |
Fun form with currentColor | Bnthor | 2,713 Kb |
Loading animation with css | Icebob | 2,947 Kb |
Another brick in the wall | Fivera | 1,955 Kb |
Elephants Full screen site | Orrinward | 3,981 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!