Random Paint
How do I make an random paint?
Playing around with paper.js.. What is a random paint? How do you make a random paint? This script and codes were developed by Oliver Kühn on 15 November 2022, Tuesday.
Random Paint - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Random Paint</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <!-- This is just some very simple testing of the abilities of paper.js - check out their samples on http://paperjs.org/examples ! -->
<h2>powered by <a href="http://paperjs.org/">paper.js</a></h2>
<div class="container"> <canvas id="myCanvas" resize />
</div> <script src='https://cdnjs.cloudflare.com/ajax/libs/paper.js/0.11.3/paper-full.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Random Paint - Script Codes CSS Codes
@import url(https://fonts.googleapis.com/css?family=Monda);
body { font: 12px Monda; margin: 0; padding: 0;
}
a { text-decoration: none; color: #333;
}
a:hover { text-decoration: underline;
}
h2 { position: absolute; left: 20px; top: 20px; margin: 0; font-size: 24px; color: #666; cursor: cursor;
}
.container { overflow: hidden;
}
#myCanvas { width: 100%; height: 100%;
}
Random Paint - Script Codes JS Codes
// helpers
function zerofill(value, width) { var fill = new Array(255).join('0'); return fill.slice(0, width - value.toString().length) + value.toString();
}
function randomColor() { return '#' + zerofill(Math.round(Math.random() * 0xFFFFFF).toString(16), 6);
}
// paper.js setup
paper.install(window);
window.onload = function() { paper.setup('myCanvas'); // Create a simple drawing tool: var tool = new Tool(); var path; var paths; // Define a mousedown and mousedrag handler tool.onMouseDown = function(event) { console.info('onMouseDown'); path = new Path(); path.style = { strokeColor: randomColor(), strokeWidth: Math.max(1, 20 * Math.random()), strokeCap: 'round' }; path.add(event.point); } tool.onMouseDrag = function(event) { path.add(event.point); } tool.onMouseUp = function(event) { path.smooth(10); } /* view.onFrame = function(event) { if (path) { for (var i=0, l=path.segments.length; i<l; i++) { var p = path.segments[i].point; var r = Math.random(); r *= Math.random() > 0.5 ? -1 : 1; path.segments[i].point = new Point(p.x + r, p.y + r); //console.info(path.segments[i].point); } } } */
}
Developer | Oliver Kühn |
Username | 0x04 |
Uploaded | November 15, 2022 |
Rating | 3.5 |
Size | 2,444 Kb |
Views | 30,360 |
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 |
Pentagon loading indicator | 2,371 Kb |
Perforated foil | 2,617 Kb |
Border loading indicators | 3,025 Kb |
ASCIICanvas | 6,516 Kb |
Unicode glitching | 1,632 Kb |
Scanline effect | 2,245 Kb |
Hover rotating cube | 3,166 Kb |
Pure CSS Jalousien | 2,238 Kb |
FourPerfectlyRoundCircles | 5,772 Kb |
Background-blend-mode Test | 4,744 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 |
Bootstrap 3 Price Table | Honglio | 2,655 Kb |
Price | Catcode | 2,623 Kb |
Vue.js | Thommyboy02 | 1,506 Kb |
Nice responsive team page | Infomiho | 3,139 Kb |
Google Chrome Icon using Pure CSS in one DIV | Grssam | 3,627 Kb |
Board Site | IndianaLuft | 10,542 Kb |
Nested table email layout | Massimo-cassandro | 2,355 Kb |
Tab panels | Accessibility | 0 Kb |
CSS Donut Charts | Seanstopnik | 2,908 Kb |
Text Looping Transition | Agelber | 5,619 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!