Canvas Arc

Developer
Size
2,389 Kb
Views
10,120

How do I make an canvas arc?

This is about the simplist of canvas arcs/circles; mostly for reference.. What is a canvas arc? How do you make a canvas arc? This script and codes were developed by Adam on 07 January 2023, Saturday.

Canvas Arc Previews

Canvas Arc - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Canvas Arc</title> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ *, *:before, *:after { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; margin: 0; padding: 0;}
body {
background: #000;
}
.progress { position: relative; width: 300px; height: 300px;
}
.progress:before { content: ""; display: block; width: 100%; height: 100%; border: 60px solid #111; border-radius: 50%;
}
#bar { position: absolute; top: 0; left: 0;
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <div class="progress"> <canvas id="bar" width="300" height="300"></canvas>
</div> <script src="js/index.js"></script>
</body>
</html>

Canvas Arc - Script Codes CSS Codes

*, *:before, *:after { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; margin: 0; padding: 0;}
body {
background: #000;
}
.progress { position: relative; width: 300px; height: 300px;
}
.progress:before { content: ""; display: block; width: 100%; height: 100%; border: 60px solid #111; border-radius: 50%;
}
#bar { position: absolute; top: 0; left: 0;
}

Canvas Arc - Script Codes JS Codes

var canvas = document.getElementById('bar');
if (canvas.getContext){ var ctx = canvas.getContext('2d'); ctx.lineWidth = 45; ctx.strokeStyle = '#000'; ctx.shadowColor = '#08f'; ctx.shadowOffsetX = 0; ctx.shadowOffsetY = 0; ctx.shadowBlur = 25; ctx.beginPath(); var x = 150; // x coordinate var y = 150; // y coordinate var radius = 120; // Arc radius var startAngle = 0; // Starting point on circle var endAngle = Math.PI/0.6; // End point on circle var anticlockwise = 0%2==0 ? false : true; // clockwise or anticlockwise ctx.arc(x, y, radius, startAngle, endAngle, anticlockwise); { ctx.stroke(); }
}
Canvas Arc - Script Codes
Canvas Arc - Script Codes
Home Page Home
Developer Adam
Username depthdev
Uploaded January 07, 2023
Rating 3
Size 2,389 Kb
Views 10,120
Do you need developer help for Canvas Arc?

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!

Adam (depthdev) 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!