The program which need to be used is Processing 3 and mode : Python. def setup()
ID: 3869794 • Letter: T
Question
The program which need to be used is Processing 3 and mode : Python.
def setup():
size(800, 800)
def draw():
background (150)
rectMode(CENTER)
fill(255, 0, 0)
rect(mouseX, mouseY, 400, 120)
#cab
rect(mouseX, mouseY-110, 150, 100)
stroke(130, 50, 40)
fill('#DEF8FA')
rect(mouseX, mouseY-110, 130, 85)
#windshield
fill('#DEF8FA')
triangle(mouseX-75, mouseY-160, mouseX-75, mouseY- 60, mouseX-120, mouseY-60)
#rear glass
triangle(mouseX+75, mouseY-160, mouseX+75, mouseY-60, mouseX+120, mouseY-60)
#tires
fill(0)
ellipse(mouseX - 100, mouseY + 50, 124, 124)
ellipse(mouseX + 110, mouseY + 50, 124, 124)
#wheels
fill(255)
ellipse(mouseX - 100, mouseY + 50, 80, 80)
ellipse(mouseX + 110, mouseY + 50, 80, 80)
This code will draw a car.
Now, here is what need to be done to the code above.
1. Slow the frame rate to 20 frames per second.
2. Translate the origin to the current mouse location.
3. Print the current mouse location to the console.
4. Use variables to replace the car body’s width and height and the cab’s width and height.
5. Make the tires’ diameters randomly alternate by 15 pixels
Explanation / Answer
the Python programming language, along with a bunch of examples. These might be useful if you want to see some of the features without actually learning the language itself.
You don't have to read through all of this in order. Just pick the pages which look most interesting to you. The topics are fairly independent from each other and don't require any existing knowledge about Python.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.