

Introduction to functions in CMU graphics
Presentation
•
Other
•
9th - 12th Grade
•
Medium
Benjamin Griffel
Used 5+ times
FREE Resource
8 Slides • 6 Questions
1
Introduction to functions in CMU graphics

2
Functions are built in programs that you can use
When we write a program, we are combining the built in functions or sometimes writing new ones
3
We have already used many functions such as
Circle()
gradient()
rgb()
and others
4
Multiple Choice
Which of these is not a function?
Rect(200,200,100,140)
Circle(200,200,40)
fill = 100
gradient('red','blue')
5
Parts of a function - using Circle as example
Circle(200,150,50, fill = 'red', opacity = 40)
name of the function is Circle()
200, 150, and 50 are the required arguments (they represent x, y , and radius)
fill and opacity are optional arguments, you don't need them for the code to work
6
Using functions,
Up till now, when we wanted to use a function we just typed in the name with the options we wanted
this is called "calling a function"
7
onMousePress(mouseX, MouseY) is a special function
we do not call this function by typing a line of code. We modify the function itself using code, but this function only is "called" when the mouse is clicked. In other words the computer does not follow these instructions in the function unless we click.
8
9
function body
the computer does everything in the function body when the function is used
for onMousePress( ) that means all that stuff happens when you click
10
Multiple Choice
What does this code do and when?
draws a darkOrange circle when you click run
draws a darkOrange circle but only when you click on the canvas
draws a blue circle when you click run
draws a blue circle when you click on the canvas
11
Multiple Choice
Where does the circle get drawn?
the middle of the screen
it's picked randomly
at the spot we click the mouse
12
Multiple Choice
How many shapes are drawn when you click run?
0
1
2
3
13
Multiple Choice
How many total shapes are on the screen after we click run, and then click on the canvas?
0
1
2
3
14
Multiple Choice
Why don't the shapes appear where the mouse pointer is pointing?
because the code doesn't use the values of mouseX or mouseY in the shape functions
because we are not clicking at the right part of the screen
we need to double click
the code is wrong!
Introduction to functions in CMU graphics

Show answer
Auto Play
Slide 1 / 14
SLIDE
Similar Resources on Wayground
11 questions
Quadrilaterals
Presentation
•
9th - 12th Grade
12 questions
Medical Math- Military Time
Presentation
•
9th - 12th Grade
10 questions
Distracted Driving
Presentation
•
10th - 12th Grade
13 questions
CTE/Career Technical Education -16 Career Clusters
Presentation
•
9th - 12th Grade
13 questions
Digital Citizenship & Safety
Presentation
•
9th - 12th Grade
10 questions
Absolute Value Equations
Presentation
•
9th - 12th Grade
11 questions
SMART Goals and Goal Setting
Presentation
•
9th - 12th Grade
9 questions
Spanish Demonstrative Adjectives
Presentation
•
9th - 12th Grade
Popular Resources on Wayground
20 questions
STAAR Review Quiz #3
Quiz
•
8th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
6 questions
Marshmallow Farm Quiz
Quiz
•
2nd - 5th Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
20 questions
Inferences
Quiz
•
4th Grade
19 questions
Classifying Quadrilaterals
Quiz
•
3rd Grade
12 questions
What makes Nebraska's government unique?
Quiz
•
4th - 5th Grade
Discover more resources for Other
7 questions
Warm Up 04.01.2026
Quiz
•
9th Grade
50 questions
STAAR English 2 Review
Quiz
•
10th Grade
20 questions
Graphing Inequalities on a Number Line
Quiz
•
6th - 9th Grade
20 questions
Figurative Language Review
Quiz
•
10th Grade
20 questions
Linear Functions Review
Quiz
•
9th Grade
30 questions
English 1 STAAR Review
Quiz
•
9th Grade
10 questions
Pythagorean Theorem and its Converse
Quiz
•
7th - 9th Grade
14 questions
Ecological Succession: Primary and Secondary
Quiz
•
9th Grade