I’m trying to make a gradient, yet it just doesn’t seem to work my way. Could someone please let me know what is wrong with the code below? I can’t seem to fix it
def setup():
size(550, 700)
noSmooth()
def draw():
for(int y = 0; y < height; y++)
for(int x = 0; x < width; x++)
float distanceFromCenter = dist(x, y, width/2, height/2)
stroke(distanceFromCenter)
point(x, y)
Your code is half Python, half Java. This should be:
def setup():
size(550, 700)
noSmooth()
def draw():
for y in range(height):
for x in range(width):
distanceFromCenter = dist(x, y, width/2, height/2)
stroke(distanceFromCenter)
point(x, y)
I was helping you by directing you to resources that will help you with this problem and future ones.
I do not work with Python and was able to answer your question and write code from those references.