Mountains
How do I make an mountains?
Inspiration: https://www.openprocessing.org/sketch/85797. What is a mountains? How do you make a mountains? This script and codes were developed by Pogany on 09 November 2022, Wednesday.
Mountains - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Mountains</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <canvas id="canvas"></canvas> <script src="js/index.js"></script>
</body>
</html>
Mountains - Script Codes CSS Codes
body { background-color: #333; overflow: hidden;
}
canvas { background-color: rgb(200,200,200); display: block; margin: 0 auto; margin:calc(50vh - 250px) auto;
}
Mountains - Script Codes JS Codes
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
var cw = canvas.width = 800, cx = cw / 2;
var ch = canvas.height = 500, cy = 2*ch / 3;
ctx.strokeStyle = "#fff";
var rad = Math.PI / 180;
var rot;
var R = 100;
var r = 40;
var c = { x: -R, y: cy
}
var points = [];
var angles = [{ a: -20 * rad, r: r
}, { a: +107 * rad, r: R
}, { a: -95 * rad, r: r
}, { a: +75 * rad, r: R
}, { a: +117 * rad, r: r
}, { a: -100 * rad, r: R
}];
function Point(o) { this.a = o.a; this.r = o.r; this.x = c.x + this.r * Math.cos(this.a); this.y = c.y + this.r * Math.sin(this.a); this.rotatePoint = function(c, rot) { var cos = Math.cos(rot); var sin = Math.sin(rot); var x = c.x + (this.x - c.x) * cos - (this.y - c.y) * sin; var y = c.y + (this.x - c.x) * sin + (this.y - c.y) * cos; this.x = x; this.y = y; }
}
function drawShape() { drawLine(points[0], points[1], "rgba(255,255,255,.3)"); drawLine(points[1], points[2], "rgba(200,200,200,.3)"); drawLine(points[2], points[0], "rgba(175,175,175,.3)"); drawLine(points[3], points[4], "rgba(150,150,150,.3)"); drawLine(points[4], points[5], "rgba(100,100,100,.3)"); drawLine(points[5], points[3], "rgba(50,50,50,.3)");
}
for (var i = 0; i < angles.length; i++) { var point = new Point(angles[i]); points.push(point);
}
ctx.save();
var d = -R;
var h = 0;
function Draw() { requestId = window.requestAnimationFrame(Draw); rot = -.01; if (d <= cw + R) { d++; ctx.translate(1, 0); } else { d = -R; c = { x: -R, y: cy }; ctx.restore(); ctx.save(); } for (var i = 0; i < points.length; i++) { points[i].rotatePoint(c, rot); } drawShape();
}
Draw();
function drawLine(p1, p2, stroke) { ctx.beginPath(); ctx.strokeStyle = stroke; ctx.moveTo(p1.x, p1.y); ctx.lineTo(p2.x, p2.y); ctx.stroke();
}
Developer | Pogany |
Username | giaco |
Uploaded | November 09, 2022 |
Rating | 3 |
Size | 2,389 Kb |
Views | 10,120 |
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 |
Matrix Falling Code | 52,476 Kb |
Helianthus | 1,995 Kb |
Fuzzies | 2,338 Kb |
Basket | 2,297 Kb |
Tiles | 2,018 Kb |
Tiles nr.2 | 2,030 Kb |
Out of the blue | 2,537 Kb |
Circles | 2,621 Kb |
Swim Smooth | 2,897 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 |
Bootstrap example | Ssaakkaa | 2,716 Kb |
Price | Catcode | 2,623 Kb |
BlueBox Fork | Huskynation | 12,675 Kb |
Wikipedia API | Coderpilot | 2,802 Kb |
OnScreenAction | Ozgursagiroglu | 2,647 Kb |
Text Looping Transition | Agelber | 5,619 Kb |
Pure CSS Read More Arrow | Zephyr | 1,747 Kb |
Loading animation with css | Icebob | 2,947 Kb |
Bloomberg Style Link Hover | Gil-- | 1,609 Kb |
JS Beispiel getElementsByClassName 3 | HSZG-Frontend-Kurs | 1,988 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!