xxxxxxxxxx
67
// Set the number of lines
const numLines = 90;
// Set the radius of the lines
const radius = 200;
// Set the line thickness
const lineThickness = 1;
// Set the speed and amplitude of the line oscillation
const oscillationSpeed = 0.1;
const oscillationAmplitude = 10;
// Set the font size and style
const fontSize = 20;
const fontStyle = 'Roboto';
function setup() {
// Create the canvas
createCanvas(800, 800);
// Set the stroke weight
strokeWeight(lineThickness);
// Set the stroke color
stroke(138, 196, 255);
fill(138, 196, 255);
// Set the text font
textFont(fontStyle);
textSize(fontSize);
// Set the text alignment
textAlign(CENTER, CENTER);
// Set the frame rate
frameRate(60);
}
function draw() {
// Clear the canvas
clear();
// Translate the origin to the center of the canvas
translate(width/2, height/2);
// Loop through the lines
for (let i = 0; i < numLines; i++) {
// Calculate the angle of the line
let angle = TWO_PI * i / numLines;
// Calculate the x and y components of the line end point
let x = radius * cos(angle);
let y = radius * sin(angle);
// Calculate the length of the line
let lineLength = radius + oscillationAmplitude * sin(frameCount/3* oscillationSpeed + angle * i);
// Draw the line
line(radius * cos(angle)/4, radius * sin(angle)/4, x * lineLength / radius, y * lineLength / radius);
}
// Draw the text
text('Rising Sea', 0, 0);
text(' Levels', 0, 20);
}