Add completed color triads

This commit is contained in:
Lev
2021-07-28 01:24:03 -05:00
parent 33ca84b194
commit cd958becac
3 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script src="p5.min.js"></script>
<script src="sketch.js"></script>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,38 @@
let color1 = 0;
function setup() {
createCanvas(720, 400);
colorMode(HSB);
noStroke();
rectMode(CENTER);
}
function draw() {
// complementary colors
background(0);
fill(0, 100, 100);
rect(120, 120, 200, 200);
fill(180, 100, 100);
rect(120, 120, 100, 100);
// triatic colors
let startColor = 0;
let colorDiff = 360/3;
fill(startColor, 100, 100);
rect(340, 120, 200, 200);
fill(startColor + colorDiff, 100, 100);
rect(340, 120, 150, 150);
fill(startColor + colorDiff * 2, 100, 100);
rect(340, 120, 100, 100);
//if(frameCount % 10 == 0)
color1 + 1 == 360 ? color1 = 0 : color1 += 1;
//startColor = 40;
fill(color1, 100, 100);
rect(560, 120, 200, 200);
fill(color1 + colorDiff, 100, 100);
rect(560, 120, 150, 150);
fill(color1 + colorDiff * 2, 100, 100);
rect(560, 120, 100, 100);
}