P5.js Tail
How do I make an p5.js tail?
What is a p5.js tail? How do you make a p5.js tail? This script and codes were developed by Wenting Zhang on 07 November 2022, Monday.
P5.js Tail - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>p5.js Tail</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css">
</head>
<body> <script src='http://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.2/p5.js'></script> <script src="js/index.js"></script>
</body>
</html>
P5.js Tail - Script Codes JS Codes
var myTail;
function setup() { ellipseMode(CENTER); createCanvas(1440, 768); background(0); myTail = new Tail(7);
}
function draw() { myTail.update(); background("rgba(0,0,0,0.2)"); myTail.draw();
}
function Tail(n) { this.n = n; this.positions = []; for (var i = 0; i < this.n; i++) { var newPos = createVector(0, 0); append(this.positions, newPos); }
}
Tail.prototype.update = function(){ this.positions[0] = createVector(mouseX, mouseY); for(var i=1; i<this.n; i++){ this.positions[i] = p5.Vector.lerp(this.positions[i], this.positions[i-1], 0.1); }
}
Tail.prototype.draw = function(){ noStroke(); randomSeed(23); for (var i = 0; i < this.n; i++) { colorMode(HSB, 1, 1, 1); fill(random(), 0.6, 0.9); ellipse(this.positions[i].x, this.positions[i].y, 20, 20); }
}
Developer | Wenting Zhang |
Username | wentin |
Uploaded | November 07, 2022 |
Rating | 3 |
Size | 1,745 Kb |
Views | 40,480 |
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 |
Color drop animation for profession.is | 3,083 Kb |
Guitar string | 3,001 Kb |
Draw Icons with Pure CSS | 1,677 Kb |
Three.js start point | 1,866 Kb |
P5.js start point | 1,504 Kb |
Circle button animation for huffpost | 1,700 Kb |
100 days of research | 7,754 Kb |
ResponsifyJS demo | 5,586 Kb |
Angular directive poc | 3,490 Kb |
Shaking mustache | 1,708 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 |
Adding and Removing Element | Accimeesterlin | 2,119 Kb |
Prism | Pyrografix | 2,843 Kb |
Parallax with only CSS | Thulioph | 2,297 Kb |
Sitemap generator for Sharepoint | Gyusza | 2,518 Kb |
Masonry | Uriuriuriu | 5,005 Kb |
Fixed with using Calc | Tomleo | 2,542 Kb |
Wave Lines | Mikehobizal | 4,023 Kb |
Snow collision | Wojtek1150 | 3,542 Kb |
TinFoil Boats | Chandralil | 4,577 Kb |
Tail rose iris lined | Kbrtrm | 1,846 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!