A Pen by Ross B
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 - 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);
Developer | Ross B |
Username | rocbear |
Uploaded | November 24, 2022 |
Rating | 3 |
Size | 3,715 Kb |
Views | 16,192 |
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!
Name | Size |
Full page scroll-over with Skrollr | 2,633 Kb |
Canvas blend modes | 4,640 Kb |
UFO | 2,608 Kb |
Liquid gold | 6,470 Kb |
Plane vertex manipulation experiment | 4,363 Kb |
Torus light track | 4,909 Kb |
Responsive grid based FLIP.js demo | 3,883 Kb |
Spear checkboxes | 3,682 Kb |
Loading animation - freedom purchase | 2,567 Kb |
Playful inner-page navigation | 4,689 Kb |
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!
Name | Username | Size |
Light Switch | Bartuc | 4,933 Kb |
CSS- UI Element States Pseudo-Classes | Tesla809 | 2,206 Kb |
Apex Calculator | Michaelwnelson | 2,370 Kb |
Font stack | Adrianjacob | 1,868 Kb |
Mario | Takaneichinose | 3,902 Kb |
SlideDown FixedMenu | Mp_graphic | 5,602 Kb |
ABVI Menu Discarded | Overdrivemachines | 3,607 Kb |
Highbrow Basic HTML Lesson 7 | Kimlarocca | 1,662 Kb |
Learning canvas drawing | Aurer | 2,204 Kb |
Front in Aracaju Logo Pure CSS | Shankarcabus | 2,581 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!