Perlin Noise Field (via Kyle Phillips)
How do I make an perlin noise field (via kyle phillips)?
Ported Kyle Phillips demo here to test ToxicLibsJs on CodePen.io. See: http://haptic-data.com/toxiclibsjs/examples/PerlinNoise_canvas.html. What is a perlin noise field (via kyle phillips)? How do you make a perlin noise field (via kyle phillips)? This script and codes were developed by Todd Moy on 14 October 2022, Friday.
Perlin Noise Field (via Kyle Phillips) - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Perlin Noise Field (via Kyle Phillips)</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <canvas id="myCanvas" width="1280" height="400"> your browser doesnt support canvas
</canvas> <script src='https://raw.github.com/toddmoy/toxiclibsjs/master/build/toxiclibs.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Perlin Noise Field (via Kyle Phillips) - Script Codes CSS Codes
body { background-color: #000000; text-align: center;
}
Perlin Noise Field (via Kyle Phillips) - Script Codes JS Codes
var TColor = toxi.color.TColor, PerlinNoise = toxi.math.noise.PerlinNoise; var palette = [ TColor.newHex('1c0f17'), TColor.newHex('271d2e'),//.setBrightness(0.75), TColor.newHex('2c3857'), TColor.newHex('155e73').setBrightness(0.9), TColor.newHex('e8ca59'), TColor.newHex('891b1b'),//.setAlpha(0.85), TColor.newHex('35e8df') ]; var canvas = document.getElementById('myCanvas'), ctx = canvas.getContext('2d'), perlin = new toxi.math.noise.PerlinNoise(), offset = 0, options = { numStreams: 400, distort: 0, strength: Math.PI, scaler: 0.05, step: 0.5 }; streams = []; var getRandomVector = function(){ var vec = new toxi.geom.Vec2D(Math.random()*canvas.width,Math.random()*canvas.height); vec.color = palette[parseInt(Math.random()*palette.length,10)]; return vec; }; for(var i=0;i<options.numStreams;i++){ streams.push(getRandomVector()); } ctx.fillStyle = "#000000"; ctx.strokeStyle = "#ff0000"; ctx.lineWidth = .5; //ctx.fillRect(0,0,canvas.width,canvas.height); var draw = function(){ while(options.numStreams > streams.length){ streams.push(getRandomVector()); } while(options.numStreams < streams.length){ streams.shift(); } offset += options.distort; ctx.fillStyle = "rgba(0,0,0,0.05)"; ctx.fillRect(0,0,canvas.width,canvas.height); var replaceIndices = []; var lastPos = new toxi.geom.Vec2D(); streams.forEach(function(stream,i){ window._col = stream.color; ctx.strokeStyle = stream.color.toRGBACSS(); lastPos.set(stream); var noise = perlin.noise(stream.x * options.scaler,offset + stream.y*options.scaler) - 0.5; var angle = options.strength * noise; var dir = toxi.geom.Vec2D.fromTheta(angle); stream.addSelf(dir.normalizeTo(options.step * 3)); ctx.beginPath(); ctx.moveTo(lastPos.x,lastPos.y); ctx.lineTo(stream.x,stream.y); ctx.closePath(); ctx.stroke(); if(stream.x < 0 || stream.x > canvas.width || stream.y < 0 || stream.y > canvas.height){ replaceIndices.push(i); } }); replaceIndices.forEach(function(streamIndex){ streams[streamIndex] = getRandomVector(); }); setTimeout(draw, 1000 / 30); } setTimeout(draw, 1000 / 30);
Developer | Todd Moy |
Username | toddmoy |
Uploaded | October 14, 2022 |
Rating | 3 |
Size | 2,573 Kb |
Views | 12,144 |
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 |
A Pen by Todd Moy | 2,144 Kb |
Experiment | 3,868 Kb |
Menu Test | 4,460 Kb |
Annotation Test | 2,431 Kb |
Chrome Store Copy | 3,593 Kb |
Hidden Menu Test | 3,582 Kb |
Flexbox test | 2,152 Kb |
Modal Interaction Test | 3,142 Kb |
Experiment | 2,849 Kb |
SVG Animation Test | 3,102 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 |
CSS Hover Effects | Alen | 3,613 Kb |
Twinner Spinner II | Katydecorah | 2,974 Kb |
Mega Menu by Joni | Asakasinsky | 3,171 Kb |
Large canvas mousemove experiment | Jibbon | 2,885 Kb |
Midterm dry run | Jds317 | 1,649 Kb |
Basecamp 3 Document | Lachlanjc | 3,811 Kb |
Personal Logo Animation | Lloydwheeler | 3,795 Kb |
Button fills | Zubfatal | 5,205 Kb |
OnScreenAction | Ozgursagiroglu | 2,647 Kb |
Project Euler Problem 17 | Bfillmer | 2,739 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!