SlideShare une entreprise Scribd logo
1  sur  31
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

Contenu connexe

Similaire à Javascript Art for Kids - Library Program

Introduction of c_language
Introduction of c_languageIntroduction of c_language
Introduction of c_language
SINGH PROJECTS
 

Similaire à Javascript Art for Kids - Library Program (20)

Computer Graphics Concepts
Computer Graphics ConceptsComputer Graphics Concepts
Computer Graphics Concepts
 
R Programming
R ProgrammingR Programming
R Programming
 
Session1
Session1Session1
Session1
 
Lesson4.4 u4 l1 using hex
Lesson4.4 u4 l1 using hexLesson4.4 u4 l1 using hex
Lesson4.4 u4 l1 using hex
 
Engineering drawing chapter 01 introduction
Engineering drawing chapter 01 introductionEngineering drawing chapter 01 introduction
Engineering drawing chapter 01 introduction
 
Python introduction towards data science
Python introduction towards data sciencePython introduction towards data science
Python introduction towards data science
 
Cyberworx Brand identity
Cyberworx Brand identityCyberworx Brand identity
Cyberworx Brand identity
 
Unit I - 1R introduction to R program.pptx
Unit I - 1R introduction to R program.pptxUnit I - 1R introduction to R program.pptx
Unit I - 1R introduction to R program.pptx
 
Introduction to Engineering drawing and Graphics
Introduction to Engineering drawing and GraphicsIntroduction to Engineering drawing and Graphics
Introduction to Engineering drawing and Graphics
 
Artificial intelligence - python
Artificial intelligence - pythonArtificial intelligence - python
Artificial intelligence - python
 
C++ lecture 01
C++   lecture 01C++   lecture 01
C++ lecture 01
 
An Introduction To Python - Strings & I/O
An Introduction To Python - Strings & I/OAn Introduction To Python - Strings & I/O
An Introduction To Python - Strings & I/O
 
Programming in c
Programming in cProgramming in c
Programming in c
 
python.pdf
python.pdfpython.pdf
python.pdf
 
Introduction of c_language
Introduction of c_languageIntroduction of c_language
Introduction of c_language
 
python-ch2.pptx
python-ch2.pptxpython-ch2.pptx
python-ch2.pptx
 
Creating an Illustrator document for VCP118-2
Creating an Illustrator document for VCP118-2Creating an Illustrator document for VCP118-2
Creating an Illustrator document for VCP118-2
 
R programming slides
R  programming slidesR  programming slides
R programming slides
 
Introduction to Computing
Introduction to ComputingIntroduction to Computing
Introduction to Computing
 
WEB PROGRAMMING
WEB PROGRAMMINGWEB PROGRAMMING
WEB PROGRAMMING
 

Plus de Rino Landa

Plus de Rino Landa (16)

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

Dernier

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Dernier (20)

HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 

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