Medium Loader Canvas Example

Size
2,030 Kb
Views
38,456

How do I make an medium loader canvas example?

What is a medium loader canvas example? How do you make a medium loader canvas example? This script and codes were developed by Luca De Blasio on 04 September 2022, Sunday.

Medium Loader Canvas Example Previews

Medium Loader Canvas Example - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Medium Loader Canvas Example</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <canvas id="myCanvas" width="400" height="400"></canvas>
<button>Run again</button> <script src="js/index.js"></script>
</body>
</html>

Medium Loader Canvas Example - Script Codes CSS Codes

canvas { margin : 0 auto; display: block;
}
button { position: absolute; z-index: 2; background: #f06d06; right: 20px; top: 20px; color:#fff; text-transform: uppercase; border: none; padding: 10px 20px;
}

Medium Loader Canvas Example - Script Codes JS Codes

var canvas = document.getElementById("myCanvas");
canvas.width = 400;
canvas.height = 400;
var lineDashOffset = -600;
var speed = 3;
var ctx = canvas.getContext("2d");
ctx.lineDashOffset = lineDashOffset;
ctx.setLineDash([600]);
function animate() { if(lineDashOffset < 0) { lineDashOffset+=speed; ctx.clearRect(0,0,400,400); ctx.font = "20px Arial"; ctx.fillText(Math.floor(100 + lineDashOffset/6) + "%",120,100); ctx.lineDashOffset += speed; ctx.beginPath(); ctx.moveTo(50,20); ctx.lineTo(200,40); ctx.lineTo(250,100); ctx.lineTo(200,180); ctx.lineTo(100,180); ctx.closePath(); ctx.stroke(); } requestAnimationFrame(animate);
}
animate();
document.querySelector('button').addEventListener('click', function(){ lineDashOffset = -600; ctx.lineDashOffset = lineDashOffset;
})
Medium Loader Canvas Example - Script Codes
Medium Loader Canvas Example - Script Codes
Home Page Home
Developer Luca De Blasio
Username LucaDb
Uploaded September 04, 2022
Rating 3
Size 2,030 Kb
Views 38,456
Do you need developer help for Medium Loader Canvas Example?

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!

Luca De Blasio (LucaDb) Script Codes
Create amazing sales emails 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!