window.addEventListener('load', function() { const canvas = this.document.getElementById('canvas1'); const ctx = canvas.getContext('2d'); canvas.width = 1500; canvas.height = 500; class Perlin { // number of points to generate #NUM_POINTS = 101; // number of prime numbers in each array #NUM_PRIMES = 5; #PRIME5 = [ 15731, 16069, 17579, 31963, 22453]; #PRIME6 = [ 789221, 790289, 811081, 211777, 566173]; #PRIME10 = [1376312589, 1480028201, 1500450271, 1000075057, 1023465798]; constructor() { this.points = [] this.p5d = this.#PRIME5[Math.floor(Math.random() * 5)]; this.p6d = this.#PRIME6[Math.floor(Math.random() * 5)]; this.p10d = this.#PRIME10[Math.floor(Math.random() * 5)]; console.log("p5d: " + this.p5d); console.log("p6d: " + this.p6d); console.log("p10d: " + this.p10d); } init() { for(let i = 0; i < NUM_POINTS; i++) { this.points[i] = 0.0; } } } let perlin1 = new Perlin(); let perlin2 = new Perlin(); }); /* Ref: Make Your Own Animated 2D Games Author: Frank Dvorak Udemy Course */