- float[] dailyTemperatures = {20, 22, 23, 25, 24, 22, 21, 20, 19, 18, 17, 16, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 30};
- int numDays = dailyTemperatures.length;
- void setup() {
- size(800, 800);
- background(255);
- smooth();
- // Center of the canvas
- float centerX = width / 2;
- float centerY = height / 2;
- // Draw swirling curves representing temperature variations
- translate(centerX, centerY);
- float angleIncrement = TWO_PI / numDays;
- for (int i = 0; i < numDays; i++) {
- float radius = map(dailyTemperatures[i], 15, 30, 100, 300);
- float angle = i * angleIncrement;
- float x = cos(angle) * radius;
- float y = sin(angle) * radius;
- float nextX = cos((i + 1) * angleIncrement) * radius;
- float nextY = sin((i + 1) * angleIncrement) * radius;
- float c / 2;
- float c / 2;
- float c / 2;
- float c / 2;
- noFill();
- stroke(0);
- strokeWeight(2);
- bezier(0, 0, controlX1, controlY1, controlX2, controlY2, nextX, nextY);
- }
- }