Friday, October 28, 2022
Friday, October 21, 2022
Draw Circle
<button onclick="circle()">Draw Circle</button>
<canvas height="400" id="canvas" width="500">
</canvas>
<script>
function circle() {
const canvas = document.querySelector('#canvas');
if (!canvas.getContext) {
return;
}
const ctx = canvas.getContext('2d');
// set line stroke and line width
ctx.strokeStyle = 'red';
ctx.lineWidth = 5;
// draw a red line
ctx.beginPath();
ctx.moveTo(200, 100);
var x,y,r,a;
r=100;
for(let a=0; a<8;a=a+0.01)
{y=100+r*Math.sin(a);
x=100+r*Math.cos(a);
ctx.lineTo(x, y);
}
ctx.stroke();
}
</script>
<canvas height="400" id="canvas" width="500">
</canvas>
<script>
function circle() {
const canvas = document.querySelector('#canvas');
if (!canvas.getContext) {
return;
}
const ctx = canvas.getContext('2d');
// set line stroke and line width
ctx.strokeStyle = 'red';
ctx.lineWidth = 5;
// draw a red line
ctx.beginPath();
ctx.moveTo(200, 100);
var x,y,r,a;
r=100;
for(let a=0; a<8;a=a+0.01)
{y=100+r*Math.sin(a);
x=100+r*Math.cos(a);
ctx.lineTo(x, y);
}
ctx.stroke();
}
</script>
Subscribe to:
Posts (Atom)
Array Occupancy Manager
#include <iostream> using namespace std; // Function to store a number in an unoccupied array element void storeNumber(int arr[], bool...
-
#include <iostream> using namespace std; // Function to store a number in an unoccupied array element void storeNumber(int arr[], bool...
-
Tank Tops 11,468 Results Most Relevant Trending Newest Best Selling Text Prompts "cos(y)" Initial Resolution Thumb Runtime Short S...
-
Create a C++ program for Visual Studio that inputs a file with coordinates on the XY plane of N points, and then displays the location of th...