xxxxxxxxxx
46
/*
Based on p5.js demos by Matt DesLauriers
https://github.com/mattdesl/workshop-p5-intro
The MIT License (MIT) Copyright (c) 2019 Matt DesLauriers
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
let angle = 0;
function setup () {
createCanvas(windowWidth, windowHeight);
}
function windowResized () {
resizeCanvas(windowWidth, windowHeight);
background(0);
}
function draw(){
background(0, 35);
translate(width/2, height/2); //changes the origin point to be in the middle of the screen
let minDimension = min(width, height);
// noFill();
strokeWeight(minDimension * 0.025); //has the stroke weight to be comparative to the minimun dimensions of the screen
stroke('turquoise');
fill('turquoise');
let radius = minDimension * 0.25; //has the radius be comparative to the minimum dimensions of the width and height of the screen
let x = cos(1) * radius; //uses the cosine function to allow the circle to move in a continuous loop and helps move it in a circle
let y = sin(angle) * radius; //uses the sine function to allow the circle to move in a continuous loop and helps move it in a circle
circle(x, y, radius * 0.75);
// circle(x*3, y, radius * 0.75);
angle+= 0.02;
}