A Pen by Ross B

Developer
Size
3,715 Kb
Views
16,192

How do I make an a pen by ross b?

What is a a pen by ross b? How do you make a a pen by ross b? This script and codes were developed by Ross B on 24 November 2022, Thursday.

A Pen by Ross B Previews

A Pen by Ross B - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>A Pen by Ross B</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body>
<canvas></canvas> <script src="js/index.js"></script>
</body>
</html>

A Pen by Ross B - Script Codes CSS Codes

*, :before, :after { box-sizing: border-box;
}
html, body { height: 100%;
}
canvas { display: block; width: 100%; height: 100%;
}

A Pen by Ross B - Script Codes JS Codes

'use strict';
/*
** Points are stored as [x, y]
** because reasons, you dingus
*/
var colors = ['#F75F51', '#F9D36B', '#4FC6B3', '#EDE1B5', '#A56F5B'];
var colors2 = ['#594F4F', '#547980', '#45ADA8', '#9DE0AD', '#E5FCC2', '#FE4365', '#FC9D9A', '#F9CDAD', '#C8C8A9', '#83AF9B', '#F75F51', '#F9D36B', '#4FC6B3', '#EDE1B5', '#A56F5B'];
var colors3 = ['rgba(200, 50, 40, 0.7)', 'rgba(200, 50, 40, 0.6)', 'rgba(200, 50, 40, 0.5)', 'rgba(200, 50, 40, 0.4)', 'rgba(200, 50, 40, 0.3)', 'rgba(200, 50, 40, 0.2)'];
var canvas = document.querySelector('canvas');
var ctx = canvas.getContext('2d');
var fitCanvasToWindow = function fitCanvasToWindow(c) { c.width = window.innerWidth; c.height = window.innerHeight;
};
fitCanvasToWindow(canvas);
var discRadius = 3;
var spacing = [2, 2];
var drawDisc = function drawDisc(fill, p) { var r = arguments.length <= 2 || arguments[2] === undefined ? discRadius : arguments[2]; ctx.beginPath(); ctx.arc(p[0] + r, p[1] + r, r, 0, 2 * Math.PI, false); ctx.fillStyle = fill; ctx.fill();
};
var discFitsHorizontally = function discFitsHorizontally(origin, width, r, p) { return p[0] > origin[0] - 1 && p[0] + r * 2 < origin[0] + width + 1;
};
var discFitsVertically = function discFitsVertically(origin, height, r, p) { return p[1] > origin[1] - 1 && p[1] + r * 2 < origin[1] + height + 1;
};
var discFitsInGrid = function discFitsInGrid(origin, width, height, r, p) { return discFitsHorizontally(origin, width, r, p) && discFitsVertically(origin, height, r, p);
};
var drawDiscGrid = function drawDiscGrid(padding, origin, width, height, spacing, r) { var paddedOrigin = origin.map(function (v) { return v + padding; }); var maxDiscs = 10000; var discCount = 0; var penPosition = origin.map(function (v) { return v + padding; });; while (discFitsInGrid(paddedOrigin, width - padding, height - padding, r, penPosition) && discCount < maxDiscs) { var colorIndex = discCount % colors3.length; drawDisc(colors3[colorIndex], penPosition, r); discCount++; penPosition[0] = penPosition[0] + r * 2 + spacing[0]; if (!discFitsHorizontally(paddedOrigin, width, r, penPosition)) { penPosition = [paddedOrigin[0], penPosition[1] + r * 2 + spacing[1]]; } }
};
window.onresize = function () { fitCanvasToWindow(canvas); drawDiscGrid(0, [0, 0], canvas.width, canvas.height, spacing, discRadius);
};
drawDiscGrid(0, [0, 0], canvas.width, canvas.height, spacing, discRadius);
A Pen by Ross B - Script Codes
A Pen by Ross B - Script Codes
Home Page Home
Developer Ross B
Username rocbear
Uploaded November 24, 2022
Rating 3
Size 3,715 Kb
Views 16,192
Do you need developer help for A Pen by Ross B?

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!

Ross B (rocbear) 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!