Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <body>
- <canvas id="myCanvas" width="4000" height="4000" style="border:1px solid #d3d3d3; background-color: #424242;">
- Your browser does not support the HTML5 canvas tag.</canvas>
- <script>
- var c = document.getElementById("myCanvas");
- var ctx = c.getContext("2d");
- var startx = 2000;
- var starty = 2000;
- var paddings = 30;
- var start_ang = 6.25;
- var end_ang = 6.28;
- function isPrime(num) {
- var sqrtnum=Math.floor(Math.sqrt(num));
- var prime = num != 1;
- for(var i=2; i<sqrtnum+1; i++) {
- if(num % i == 0) {
- prime = false;
- break;
- }
- }
- return prime;
- }
- function circleDots(iterations, step, step_inc){
- var count = 0;
- for(var i = 0; i < iterations; i++){
- for(var j = 628; j > 0; j--){
- dotPlot(count, step);
- count++;
- }
- step = step + step_inc;
- }
- }
- function darkener(spans, pads, incrementz, iterations){
- for(var i = 0; i < iterations; i++){
- circleDots(spans, pads, incrementz);
- }
- }
- darkener(1500, 0, 2, 5);
- function decimaler(num){
- var decified = num / 100;
- return decified;
- }
- function dotPlot(position, step){
- var increment = .3;
- var stringed_pos = position.toString();
- if(isPrime(position) === true){
- if(stringed_pos.charAt(stringed_pos.length - 1) == 1){//testing some conditionals
- position = position + 5;
- DrawArc(startx, starty, paddings + step, decimaler(position - increment), decimaler(position));
- }
- if(stringed_pos.charAt(stringed_pos.length - 1) == 3){//testing some conditionals
- position = position + 3;
- DrawArc(startx, starty, paddings + step, decimaler(position - increment), decimaler(position));
- }
- if(stringed_pos.charAt(stringed_pos.length - 1) == 7){//testing some conditionals
- position = position - 1;
- DrawArc(startx, starty, paddings + step, decimaler(position - increment), decimaler(position));
- }
- if(stringed_pos.charAt(stringed_pos.length - 1) == 9){//testing some conditionals
- position = position - 3;
- DrawArc(startx, starty, paddings + step, decimaler(position - increment), decimaler(position));
- }/*
- DrawArc(startx, starty, paddings + step, decimaler(position - increment), decimaler(position));
- */
- } /*
- else{
- DrawArcRed(startx, starty, paddings + step, decimaler(position - increment), decimaler(position));
- } */
- }
- function DrawArc(start_x, start_y, padding, start_a, end_a){
- ctx.strokeStyle = "black";
- ctx.beginPath();
- ctx.arc(start_x, start_y, padding, start_a, end_a);
- ctx.stroke();
- }
- function DrawArcRed(start_x, start_y, padding, start_a, end_a){
- ctx.strokeStyle = '#595959';
- ctx.beginPath();
- ctx.arc(start_x, start_y, padding, start_a, end_a);
- ctx.stroke();
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment