-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
var weatherData;
var position;
var radius = 50;
function preload() {
var url = "http://api.openweathermap.org/data/2.5/weather?q=New%20York,NY&APPID=7bbbb47522848e8b9c26ba35c226c734";
weatherData = loadJSON(url);
}
function setup() {
createCanvas(620, 155);
position = createVector(width / 2, height / 2);
wind = createVector(0, 0);
background(253, 238, 35);
setWeather(weatherData);
noStroke();
}
function draw() {
background(253, 238, 35, 20);
position.add(wind);
fill(0);
ellipse(position.x, position.y, 2*radius, 2*radius);
if (position.x > width + radius) position.x = -radius;
if (position.x < -radius) position.x = width + radius;
if (position.y > height + radius) position.y = -radius;
if (position.y < -radius) position.y = height + radius;
}
function setWeather(weather) {
var angle = radians(weather.wind.deg);
var windmag = weather.wind.speed;
wind = p5.Vector.fromAngle(angle);
}Metadata
Metadata
Assignees
Labels
No labels