SlideShare a Scribd company logo
JavaScript
Art
Drawing with
Programming
What is JavaScript
JavaScript is a programming language.
Like English and
other languages,
there are RULES
for writing. This
is called syntax.
What does it mean?
You write code on LINES
Each line is numbered.
Blank spaces DON’T Matter
Some Rules to Know
1. TOP  DOWN & LEFT  RIGHT
matters!
When you write your code the order it’s
added will tell the computer what to do: IN
THAT ORDER.
2. Always end with a semicolon;
3. SeNTencE cAsE Matters!
A computer can’t see; it can only read
Some Rules to Know
4. Starting with double slash makes notes
Anything after // will not be code.
It’s just a note to help you keep
track of things.
5. The Equals sign is not really an
“equals” sign. It means Assign.
It’s read as “GETS”. The left is a
variable and the right is a value.
Our Programming Portal
http://bit.ly/jsart
Our Programing Field
y = 400 max
x = 400 max
We draw everything inside a square that’s 400
pixels tall (y) and 400 pixels wide (x).
Drawing a Square
rect(x, y, w, h)
Try putting in “50” for
all the values.
Position Measure: Coordinates
rect(x, y, w, h)
The position, x and y,
is measured from the
top left corner of the
space you work.
y=50
X=50
Size Measure: Width & Height
rect(x, y, w, h)
The width & height
dimensions(w & h) are
measured from the TOP
LEFT corner of the shape.
h=50
w=50
Add Squares
Each new
rectangle/square
should be on its
own line. This helps humans.
Computers just need to
see the “;” at the end.
Draw a House of Squares
We now have a
basic shape for a
house.
But we need more
shapes and some
color to make this
even better.
Drawing a Triangle
Triangle(x1,y1,x2,y2,x3,y3)
A triangle is made
up of three pairs
of x and y
Drawing a Triangle
Triangle(x1,y1,x2,y2,x3,y3)
X1 & Y1
X2 & Y2 X3 & Y3
Remember: these are
the coordinates from
the top left corner of
the space.
Draw your roof
Play around with
different values for
the position of your
roof.
Adding Color: Backgrounds
Background(r,g,b)
r  red
g  green
b  blue
Helpful Tool: Color Box
Normally you don’t
automatically get this
color box.
Usually programmers have to look up the color
they need. The values range from 0 to 255.
Black is (0,0,0) and White (255,255,255)
Position
Background has to go before the other
shapes. It should be a lower number.
Line Colors
stroke(r,g,b)
Stroke changes the color
of all the lines after where
its placed.
No Lines
noStroke()
noStroke removes the
color of all the lines after
where its placed.
Notice: the “S” is
capitalized
Fill: Color for shapes
fill(r, g, b)
Fill will color in shapes
after where it’s placed.
Transparent Shapes (with lines)
noFill()
noFill will remove color
from shapes after where
its placed.
Delete “noStroke” or
you won’t have lines
Coloring Parts
As you color you’ll
notice that fill will
layer over past colors.
Other Shapes: Ellipse
elipse(x, y, w, h)
An ellipse can make a
circle for our sun.
NOTE: The x & y coordinates and the dimensions
are based on the CENTER of the ellipse
Other Shapes: Lines
line(x1, y1, x2, y2)
Add a line to the roof.
NOTE: The x1 & y1 coordinates are one end of the
line; x2 & y2 are the other end point.
Variables: Neat Shortcuts
var = value
When you change “windowSize” you’ll
change both windows!
Text: Adding Words
textSize(size)
text(text, x, y)
You have to set the size, color, content,
and location of the text.
Text: “Welcome Home”
You need to include the
parenthesis (“xxx”)
around the text, or the
computer won’t
understand.
NOTE: The x & y coordinates are measured from the
LOWER LEFT corner of the TEXT.
Documentation
Documentation is the guide, translator,
and dictionary for a programming
language.
Documentation
Good programmers read and have the
documentation open to help them write their
code.
Original Class Design & Guide by
Rino A. Landa July 26, 2014
FAIR USE NOTICE: This presentation contains copyrighted material the use of which has not
always been specifically authorized by the copyright owner, including but not limited to logos and
product images. Such material is made available in an effort to educate the public through
illustrative examples and to properly identify content.
The use of this presentation for educational purposes is held to constitute a 'fair use' of any such
copyrighted material as provided for in section 107 of the US Copyright Law. In accordance with
Title 17 U.S.C. Section 107, the material on this presentation is distributed without profit to those
who have expressed a prior interest in receiving the included information for research and
educational purposes.
If you wish to use copyrighted material from this presentation for purposes of your own that go
beyond 'fair use', you must obtain permission from the copyright owner.
CC BY-NC-SA 4.0

More Related Content

PPTX
A sign by any other name
PPTX
SIGNWRITING SYMPOSIUM 2017: Sutton SignWriting Standard of 2017 by Stephen E....
PPS
Learning flash by Ms. Payal Narula
PPTX
GRADE 8 - COMPUTER ADOBE FLASH CS6
PPT
3D Introduction
PDF
An introduction to inkscape
PPTX
Introduction TO Microsoft Access
PPTX
SignWriting in Unicode dot SWU
A sign by any other name
SIGNWRITING SYMPOSIUM 2017: Sutton SignWriting Standard of 2017 by Stephen E....
Learning flash by Ms. Payal Narula
GRADE 8 - COMPUTER ADOBE FLASH CS6
3D Introduction
An introduction to inkscape
Introduction TO Microsoft Access
SignWriting in Unicode dot SWU

Similar to Javascript Art for Kids - Library Program (20)

PDF
Computer Graphics Concepts
DOCX
R Programming
KEY
Session1
PPTX
Lesson4.4 u4 l1 using hex
PPT
some mechanical drawing notes for eng.ppt
PPT
Chapter 01 Introduction to internal combustion Engine.ppt
PPT
Engineering drawing chapter 01 introduction
PPTX
Python introduction towards data science
PDF
Cyberworx Brand identity
PPTX
Unit I - 1R introduction to R program.pptx
PPTX
Introduction to Engineering drawing and Graphics
DOCX
Artificial intelligence - python
PPTX
C++ lecture 01
PPTX
An Introduction To Python - Strings & I/O
PPSX
Programming in c
PDF
python.pdf
PDF
Introduction of c_language
PPTX
python-ch2.pptx
PPTX
Creating an Illustrator document for VCP118-2
PPT
R programming slides
Computer Graphics Concepts
R Programming
Session1
Lesson4.4 u4 l1 using hex
some mechanical drawing notes for eng.ppt
Chapter 01 Introduction to internal combustion Engine.ppt
Engineering drawing chapter 01 introduction
Python introduction towards data science
Cyberworx Brand identity
Unit I - 1R introduction to R program.pptx
Introduction to Engineering drawing and Graphics
Artificial intelligence - python
C++ lecture 01
An Introduction To Python - Strings & I/O
Programming in c
python.pdf
Introduction of c_language
python-ch2.pptx
Creating an Illustrator document for VCP118-2
R programming slides
Ad

More from Rino Landa (16)

PPTX
Online Privacy Basics - Library Program
PPTX
Shooter Game Design with Sploder - Library Program
PPTX
Arcade Game Design with Sploder - Library Program
PPTX
Platformer Game Design with Sploder - Library Program
PPTX
Digital Coloring Books: Coloring Images with GIMP - Library Program
PPTX
3D Printing: An Introduction - Library Program
PPTX
Digital Art: Drawing, Inking, and Coloring - A Library Program
PPTX
Predictive Text Stories - Library Program
PPTX
Inkscape: Creating a Custom Icon / Logo
PPTX
Crazy Photos: An Introduction to GIMP
PPTX
Mastering Google Search
PPTX
Free and Legal: Copyright and Online Content
PPTX
Craigslist: The Basics
PPTX
Blogging Basics
PPTX
Android Basics (Updated Feb. 2016)
PPTX
Cut the Cord: Streaming & Entertainment Online
Online Privacy Basics - Library Program
Shooter Game Design with Sploder - Library Program
Arcade Game Design with Sploder - Library Program
Platformer Game Design with Sploder - Library Program
Digital Coloring Books: Coloring Images with GIMP - Library Program
3D Printing: An Introduction - Library Program
Digital Art: Drawing, Inking, and Coloring - A Library Program
Predictive Text Stories - Library Program
Inkscape: Creating a Custom Icon / Logo
Crazy Photos: An Introduction to GIMP
Mastering Google Search
Free and Legal: Copyright and Online Content
Craigslist: The Basics
Blogging Basics
Android Basics (Updated Feb. 2016)
Cut the Cord: Streaming & Entertainment Online
Ad

Recently uploaded (20)

PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
master seminar digital applications in india
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PDF
Computing-Curriculum for Schools in Ghana
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
Cell Types and Its function , kingdom of life
PPTX
Institutional Correction lecture only . . .
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Classroom Observation Tools for Teachers
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
102 student loan defaulters named and shamed – Is someone you know on the list?
master seminar digital applications in india
O7-L3 Supply Chain Operations - ICLT Program
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
Computing-Curriculum for Schools in Ghana
O5-L3 Freight Transport Ops (International) V1.pdf
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Cell Types and Its function , kingdom of life
Institutional Correction lecture only . . .
Final Presentation General Medicine 03-08-2024.pptx
Classroom Observation Tools for Teachers
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Supply Chain Operations Speaking Notes -ICLT Program
Anesthesia in Laparoscopic Surgery in India
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3

Javascript Art for Kids - Library Program

  • 2. What is JavaScript JavaScript is a programming language. Like English and other languages, there are RULES for writing. This is called syntax.
  • 3. What does it mean? You write code on LINES Each line is numbered. Blank spaces DON’T Matter
  • 4. Some Rules to Know 1. TOP  DOWN & LEFT  RIGHT matters! When you write your code the order it’s added will tell the computer what to do: IN THAT ORDER. 2. Always end with a semicolon; 3. SeNTencE cAsE Matters! A computer can’t see; it can only read
  • 5. Some Rules to Know 4. Starting with double slash makes notes Anything after // will not be code. It’s just a note to help you keep track of things. 5. The Equals sign is not really an “equals” sign. It means Assign. It’s read as “GETS”. The left is a variable and the right is a value.
  • 7. Our Programing Field y = 400 max x = 400 max We draw everything inside a square that’s 400 pixels tall (y) and 400 pixels wide (x).
  • 8. Drawing a Square rect(x, y, w, h) Try putting in “50” for all the values.
  • 9. Position Measure: Coordinates rect(x, y, w, h) The position, x and y, is measured from the top left corner of the space you work. y=50 X=50
  • 10. Size Measure: Width & Height rect(x, y, w, h) The width & height dimensions(w & h) are measured from the TOP LEFT corner of the shape. h=50 w=50
  • 11. Add Squares Each new rectangle/square should be on its own line. This helps humans. Computers just need to see the “;” at the end.
  • 12. Draw a House of Squares We now have a basic shape for a house. But we need more shapes and some color to make this even better.
  • 13. Drawing a Triangle Triangle(x1,y1,x2,y2,x3,y3) A triangle is made up of three pairs of x and y
  • 14. Drawing a Triangle Triangle(x1,y1,x2,y2,x3,y3) X1 & Y1 X2 & Y2 X3 & Y3 Remember: these are the coordinates from the top left corner of the space.
  • 15. Draw your roof Play around with different values for the position of your roof.
  • 16. Adding Color: Backgrounds Background(r,g,b) r  red g  green b  blue
  • 17. Helpful Tool: Color Box Normally you don’t automatically get this color box. Usually programmers have to look up the color they need. The values range from 0 to 255. Black is (0,0,0) and White (255,255,255)
  • 18. Position Background has to go before the other shapes. It should be a lower number.
  • 19. Line Colors stroke(r,g,b) Stroke changes the color of all the lines after where its placed.
  • 20. No Lines noStroke() noStroke removes the color of all the lines after where its placed. Notice: the “S” is capitalized
  • 21. Fill: Color for shapes fill(r, g, b) Fill will color in shapes after where it’s placed.
  • 22. Transparent Shapes (with lines) noFill() noFill will remove color from shapes after where its placed. Delete “noStroke” or you won’t have lines
  • 23. Coloring Parts As you color you’ll notice that fill will layer over past colors.
  • 24. Other Shapes: Ellipse elipse(x, y, w, h) An ellipse can make a circle for our sun. NOTE: The x & y coordinates and the dimensions are based on the CENTER of the ellipse
  • 25. Other Shapes: Lines line(x1, y1, x2, y2) Add a line to the roof. NOTE: The x1 & y1 coordinates are one end of the line; x2 & y2 are the other end point.
  • 26. Variables: Neat Shortcuts var = value When you change “windowSize” you’ll change both windows!
  • 27. Text: Adding Words textSize(size) text(text, x, y) You have to set the size, color, content, and location of the text.
  • 28. Text: “Welcome Home” You need to include the parenthesis (“xxx”) around the text, or the computer won’t understand. NOTE: The x & y coordinates are measured from the LOWER LEFT corner of the TEXT.
  • 29. Documentation Documentation is the guide, translator, and dictionary for a programming language.
  • 30. Documentation Good programmers read and have the documentation open to help them write their code.
  • 31. Original Class Design & Guide by Rino A. Landa July 26, 2014 FAIR USE NOTICE: This presentation contains copyrighted material the use of which has not always been specifically authorized by the copyright owner, including but not limited to logos and product images. Such material is made available in an effort to educate the public through illustrative examples and to properly identify content. The use of this presentation for educational purposes is held to constitute a 'fair use' of any such copyrighted material as provided for in section 107 of the US Copyright Law. In accordance with Title 17 U.S.C. Section 107, the material on this presentation is distributed without profit to those who have expressed a prior interest in receiving the included information for research and educational purposes. If you wish to use copyrighted material from this presentation for purposes of your own that go beyond 'fair use', you must obtain permission from the copyright owner. CC BY-NC-SA 4.0