Learning canvas drawing

Developer
Size
2,204 Kb
Views
40,480

How do I make an learning canvas drawing?

Just an experiment in learning canvas drawing techniques. What is a learning canvas drawing? How do you make a learning canvas drawing? This script and codes were developed by Aurer on 03 August 2022, Wednesday.

Learning canvas drawing Previews

Learning canvas drawing - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Learning canvas drawing</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <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! */ html,body,canvas{ margin:0; padding:0;
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <canvas id="canvas"> Your browser does not support this application
</canvas> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Learning canvas drawing - Script Codes CSS Codes

html,body,canvas{ margin:0; padding:0;
}

Learning canvas drawing - Script Codes JS Codes

var W = canvas.width = window.innerWidth;
var H = canvas.height = window.innerHeight;
var ctx = $('#canvas')[0].getContext('2d');
var color = "rgba(255,255,255,0.2)";
var nodes = [];
var count = 3000;
ctx.fillRect(0,0,W,H);
function initialise(){ for(var i=0; i < count; i++){ var xPos = (W/100)*(Math.random()*100); var yPos = (H/100)*(Math.random()*100); var dir = Math.round( (3.6*(Math.random()*100) ) ); var node = [xPos, yPos, (10/100)*(Math.random()*100), 1, Math.random()*3]; nodes.push(node); }
}
function drawCircle(x,y,width){ ctx.fillStyle = color;	ctx.beginPath(); ctx.arc(x,y,width,0, Math.PI*2,true);	ctx.fill();
}
function draw(){ ctx.fillStyle = '#000'; ctx.fillRect(0,0,W,H); ctx.fillStyle = color; for(var i=0; i < count; i++){ var dir = nodes[i][3] ? nodes[i][1]+=nodes[i][4] : nodes[i][1]-=nodes[i][4]; if(dir >= H) nodes[i][3] = 0; if(dir <= 0) nodes[i][3] = 1; drawCircle(nodes[i][0], dir , nodes[i][2]) }
}
initialise();
setInterval(draw, 10);
Learning canvas drawing - Script Codes
Learning canvas drawing - Script Codes
Home Page Home
Developer Aurer
Username aurer
Uploaded August 03, 2022
Rating 3
Size 2,204 Kb
Views 40,480
Do you need developer help for Learning canvas drawing?

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!

Aurer (aurer) Script Codes
Create amazing Facebook ads 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!