Created
May 4, 2021 00:53
-
-
Save osteele/3e6dc02251ed0cf5f663a021046ca1e3 to your computer and use it in GitHub Desktop.
CCLab Spring 2021 Exercise 13.1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let HORIZONTAL = "HORIZONTAL"; | |
let VERTICAL = "VERTICAL"; | |
function setup() { | |
createCanvas(windowWidth, windowHeight); | |
background(100); | |
let whiteColor = color(255, 255, 255); | |
let blackColor = color(0, 0, 0); | |
let redColor = color(255, 0, 0); | |
let greenColor = color(0, 255, 0); | |
let blueColor = color(0, 0, 255); | |
gradientRect(10, 20, 100, 50, redColor, blackColor, HORIZONTAL); | |
gradientRect(10, 100, 100, 50, redColor, whiteColor, VERTICAL); | |
gradientRect(150, 20, 100, 50, blackColor, greenColor, HORIZONTAL); | |
gradientRect(150, 100, 100, 50, whiteColor, greenColor, VERTICAL); | |
gradientRect(300, 20, 100, 50, blueColor, makeTransparent(blueColor), HORIZONTAL); | |
gradientRect(300, 100, 100, 50, blueColor, makeTransparent(blueColor), VERTICAL); | |
} | |
function gradientRect() { | |
} | |
function makeTransparent(c) { | |
return colorWithAlpha(c, 0); | |
} | |
function colorWithAlpha(c, a) { | |
return color(red(c), green(c), blue(c), a); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment