SlideShare une entreprise Scribd logo
1  sur  20
Télécharger pour lire hors ligne
Coding Chinese
Dragons

in Processing 3
@stevebattle
steve.battle@uwe.ac.uk
This centipede style kite has a large Dragon head with a long train of disks for a tail.
Image courtesy of mosoma on flickr
Workshop goal
• The ‘Processing’
language is
about coding for
the visual arts.
In this workshop
you will learn
how to create an
animated Chinese
Dragon 'kite'.
Getting started
• Download Processing: 

http://www.processing.org
• Start Processing
• Create a new project: 

File > New
• Save the project as ‘dragon’: 

File > Save
Hello World
The output console
Your code
Click to run
Computer Graphics
The display window
Blue Sky
•Tools >
•Color selector…
Don’t type this
value…
Select a nice blue sky
colour, Copy then paste it into
your code
The Dragon’s Head
• The image for the Dragon’s head is at: 

http://stevebattle.github.io/dragon/head.gif
• Save image to “Downloads”
• Go back to Processing and select your code window.
• Sketch > Add File..
• Navigate to ‘head.gif’ in Downloads and Open.
• Confirm you have the image in your project:
• Sketch > Show Sketch Folder
Variables
Draw the head
Assign a value to
the variable
Centre the image on
the mouse
In Processing an
image is a PImage
This is the variable
declaration
The Dragon’s Body
1
2
3
4
5
0
6
7
The for loop
for (INITIALIZE; TEST; INCREMENT) {
...
}
initialise
loop variable, i
i ‘less than’ n test
increment i
expression
Relations
< less than
> greater than
<= less than or equals
>= greater than or equals
!= not equals
== equals
e.g. i < n
low precedence
high precedence
Expressions
* times
/ divide
%
modulo

(remainder)
+ add
- subtract
multiplicative
operators come first
multiplicative
operators come first
multiplicative
operators come first
additive
operators come second
additive
operators come second
e.g. mouseY-25*(n-i)
Use brackets to
override precedence
Co-ordinates
x coordinate
ycoordinate
y increases
as you move down the
window
origin
In Processing it’s
called a PVector
An x,y coordinate is
called a vector
Arrays
ERROR!
p is empty
Declare the array
Initialise the array
store mouse
vector in array
get
earlier mouse vectors
from array
if (CONDITION) …
else …
if statement
if
statement checks that
p is not empty
Slow the frame-rate
The Dragon’s Body
• The image for the Dragon’s body is at: 

http://stevebattle.github.io/dragon/body.gif
• Save image to “Downloads”
• Go back to Processing and select your code window.
• Sketch > Add File..
• Navigate to ‘body.gif’ in Downloads and Open.
• Confirm you have the image in your project:
• Sketch > Show Sketch Folder
Declare new variable
load image
display
image
Translate
Rotate
Coding Chinese Dragons

Contenu connexe

Similaire à Coding Chinese Dragons

From Elixir to Akka (and back) - ElixirConf Mx 2017
From Elixir to Akka (and back) - ElixirConf Mx 2017From Elixir to Akka (and back) - ElixirConf Mx 2017
From Elixir to Akka (and back) - ElixirConf Mx 2017Agustin Ramos
 
Introduction to Scala for JCConf Taiwan
Introduction to Scala for JCConf TaiwanIntroduction to Scala for JCConf Taiwan
Introduction to Scala for JCConf TaiwanJimin Hsieh
 
Introduction to Python for Plone developers
Introduction to Python for Plone developersIntroduction to Python for Plone developers
Introduction to Python for Plone developersJim Roepcke
 
Test First Teaching
Test First TeachingTest First Teaching
Test First TeachingSarah Allen
 
The Ring programming language version 1.8 book - Part 7 of 202
The Ring programming language version 1.8 book - Part 7 of 202The Ring programming language version 1.8 book - Part 7 of 202
The Ring programming language version 1.8 book - Part 7 of 202Mahmoud Samir Fayed
 
React Native One Day
React Native One DayReact Native One Day
React Native One DayTroy Miles
 
The Ring programming language version 1.5.2 book - Part 6 of 181
The Ring programming language version 1.5.2 book - Part 6 of 181The Ring programming language version 1.5.2 book - Part 6 of 181
The Ring programming language version 1.5.2 book - Part 6 of 181Mahmoud Samir Fayed
 
Numerical tour in the Python eco-system: Python, NumPy, scikit-learn
Numerical tour in the Python eco-system: Python, NumPy, scikit-learnNumerical tour in the Python eco-system: Python, NumPy, scikit-learn
Numerical tour in the Python eco-system: Python, NumPy, scikit-learnArnaud Joly
 
Django’s nasal passage
Django’s nasal passageDjango’s nasal passage
Django’s nasal passageErik Rose
 
Comparitive Analysis of Algorithm strategies
Comparitive Analysis of Algorithm strategiesComparitive Analysis of Algorithm strategies
Comparitive Analysis of Algorithm strategiesTalha Shaikh
 
Introductiontoprogramminginscala
IntroductiontoprogramminginscalaIntroductiontoprogramminginscala
IntroductiontoprogramminginscalaAmuhinda Hungai
 
Intro to React
Intro to ReactIntro to React
Intro to ReactTroy Miles
 
Making php see, confoo 2011
Making php see, confoo 2011 Making php see, confoo 2011
Making php see, confoo 2011 Bachkoutou Toutou
 
Functional Operations - Susan Potter
Functional Operations - Susan PotterFunctional Operations - Susan Potter
Functional Operations - Susan Potterdistributed matters
 

Similaire à Coding Chinese Dragons (20)

From Elixir to Akka (and back) - ElixirConf Mx 2017
From Elixir to Akka (and back) - ElixirConf Mx 2017From Elixir to Akka (and back) - ElixirConf Mx 2017
From Elixir to Akka (and back) - ElixirConf Mx 2017
 
Python lecture 8
Python lecture 8Python lecture 8
Python lecture 8
 
Introduction to Scala for JCConf Taiwan
Introduction to Scala for JCConf TaiwanIntroduction to Scala for JCConf Taiwan
Introduction to Scala for JCConf Taiwan
 
Introduction to Python for Plone developers
Introduction to Python for Plone developersIntroduction to Python for Plone developers
Introduction to Python for Plone developers
 
Test First Teaching
Test First TeachingTest First Teaching
Test First Teaching
 
The Ring programming language version 1.8 book - Part 7 of 202
The Ring programming language version 1.8 book - Part 7 of 202The Ring programming language version 1.8 book - Part 7 of 202
The Ring programming language version 1.8 book - Part 7 of 202
 
React Native One Day
React Native One DayReact Native One Day
React Native One Day
 
The Ring programming language version 1.5.2 book - Part 6 of 181
The Ring programming language version 1.5.2 book - Part 6 of 181The Ring programming language version 1.5.2 book - Part 6 of 181
The Ring programming language version 1.5.2 book - Part 6 of 181
 
Numerical tour in the Python eco-system: Python, NumPy, scikit-learn
Numerical tour in the Python eco-system: Python, NumPy, scikit-learnNumerical tour in the Python eco-system: Python, NumPy, scikit-learn
Numerical tour in the Python eco-system: Python, NumPy, scikit-learn
 
Django’s nasal passage
Django’s nasal passageDjango’s nasal passage
Django’s nasal passage
 
Functional programming
Functional programmingFunctional programming
Functional programming
 
Java tut1
Java tut1Java tut1
Java tut1
 
Tutorial java
Tutorial javaTutorial java
Tutorial java
 
Java Tut1
Java Tut1Java Tut1
Java Tut1
 
Java Tutorial
Java TutorialJava Tutorial
Java Tutorial
 
Comparitive Analysis of Algorithm strategies
Comparitive Analysis of Algorithm strategiesComparitive Analysis of Algorithm strategies
Comparitive Analysis of Algorithm strategies
 
Introductiontoprogramminginscala
IntroductiontoprogramminginscalaIntroductiontoprogramminginscala
Introductiontoprogramminginscala
 
Intro to React
Intro to ReactIntro to React
Intro to React
 
Making php see, confoo 2011
Making php see, confoo 2011 Making php see, confoo 2011
Making php see, confoo 2011
 
Functional Operations - Susan Potter
Functional Operations - Susan PotterFunctional Operations - Susan Potter
Functional Operations - Susan Potter
 

Plus de Steven Battle

Ashby's Mobile homeostat
Ashby's Mobile homeostatAshby's Mobile homeostat
Ashby's Mobile homeostatSteven Battle
 
Turtle Geometry the Python Way
Turtle Geometry the Python WayTurtle Geometry the Python Way
Turtle Geometry the Python WaySteven Battle
 
Quick & Dirty Model-Driven Architecture Evaluation
Quick & Dirty Model-Driven Architecture EvaluationQuick & Dirty Model-Driven Architecture Evaluation
Quick & Dirty Model-Driven Architecture EvaluationSteven Battle
 
Autaptic Circuits for Neural Vehicles
Autaptic Circuits for Neural VehiclesAutaptic Circuits for Neural Vehicles
Autaptic Circuits for Neural VehiclesSteven Battle
 
The Animated Android: Graphical Animation in Processing 2
The Animated Android: Graphical Animation in Processing 2The Animated Android: Graphical Animation in Processing 2
The Animated Android: Graphical Animation in Processing 2Steven Battle
 
Blitz Resurrection: Re-creating a classic 80s video game in Processing 2
Blitz Resurrection: Re-creating a classic 80s video game in Processing 2Blitz Resurrection: Re-creating a classic 80s video game in Processing 2
Blitz Resurrection: Re-creating a classic 80s video game in Processing 2Steven Battle
 
Adventures in ARM Assembler
Adventures in ARM AssemblerAdventures in ARM Assembler
Adventures in ARM AssemblerSteven Battle
 
Processing 2.0 + Open Data
Processing 2.0 + Open DataProcessing 2.0 + Open Data
Processing 2.0 + Open DataSteven Battle
 
Ecore Model Reflection in RDF
Ecore Model Reflection in RDFEcore Model Reflection in RDF
Ecore Model Reflection in RDFSteven Battle
 
Introduction to App Development with Processing 2
Introduction to App Development with Processing 2Introduction to App Development with Processing 2
Introduction to App Development with Processing 2Steven Battle
 
CycQL: A SPARQL Adapter for OpenCyc
CycQL: A SPARQL Adapter for OpenCycCycQL: A SPARQL Adapter for OpenCyc
CycQL: A SPARQL Adapter for OpenCycSteven Battle
 

Plus de Steven Battle (14)

Droid Geometry
Droid GeometryDroid Geometry
Droid Geometry
 
Squishy logic
Squishy logicSquishy logic
Squishy logic
 
Ashby's Mobile homeostat
Ashby's Mobile homeostatAshby's Mobile homeostat
Ashby's Mobile homeostat
 
Turtle Geometry the Python Way
Turtle Geometry the Python WayTurtle Geometry the Python Way
Turtle Geometry the Python Way
 
Quick & Dirty Model-Driven Architecture Evaluation
Quick & Dirty Model-Driven Architecture EvaluationQuick & Dirty Model-Driven Architecture Evaluation
Quick & Dirty Model-Driven Architecture Evaluation
 
Autaptic Circuits for Neural Vehicles
Autaptic Circuits for Neural VehiclesAutaptic Circuits for Neural Vehicles
Autaptic Circuits for Neural Vehicles
 
The Animated Android: Graphical Animation in Processing 2
The Animated Android: Graphical Animation in Processing 2The Animated Android: Graphical Animation in Processing 2
The Animated Android: Graphical Animation in Processing 2
 
Blitz Resurrection: Re-creating a classic 80s video game in Processing 2
Blitz Resurrection: Re-creating a classic 80s video game in Processing 2Blitz Resurrection: Re-creating a classic 80s video game in Processing 2
Blitz Resurrection: Re-creating a classic 80s video game in Processing 2
 
Robots Are GO!
Robots Are GO!Robots Are GO!
Robots Are GO!
 
Adventures in ARM Assembler
Adventures in ARM AssemblerAdventures in ARM Assembler
Adventures in ARM Assembler
 
Processing 2.0 + Open Data
Processing 2.0 + Open DataProcessing 2.0 + Open Data
Processing 2.0 + Open Data
 
Ecore Model Reflection in RDF
Ecore Model Reflection in RDFEcore Model Reflection in RDF
Ecore Model Reflection in RDF
 
Introduction to App Development with Processing 2
Introduction to App Development with Processing 2Introduction to App Development with Processing 2
Introduction to App Development with Processing 2
 
CycQL: A SPARQL Adapter for OpenCyc
CycQL: A SPARQL Adapter for OpenCycCycQL: A SPARQL Adapter for OpenCyc
CycQL: A SPARQL Adapter for OpenCyc
 

Dernier

Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)cama23
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
Food processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture honsFood processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture honsManeerUddin
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...JojoEDelaCruz
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 

Dernier (20)

Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
Food processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture honsFood processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture hons
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 

Coding Chinese Dragons

  • 1. Coding Chinese Dragons
 in Processing 3 @stevebattle steve.battle@uwe.ac.uk
  • 2. This centipede style kite has a large Dragon head with a long train of disks for a tail. Image courtesy of mosoma on flickr
  • 3. Workshop goal • The ‘Processing’ language is about coding for the visual arts. In this workshop you will learn how to create an animated Chinese Dragon 'kite'.
  • 4. Getting started • Download Processing: 
 http://www.processing.org • Start Processing • Create a new project: 
 File > New • Save the project as ‘dragon’: 
 File > Save
  • 5. Hello World The output console Your code Click to run
  • 7. Blue Sky •Tools > •Color selector… Don’t type this value… Select a nice blue sky colour, Copy then paste it into your code
  • 8. The Dragon’s Head • The image for the Dragon’s head is at: 
 http://stevebattle.github.io/dragon/head.gif • Save image to “Downloads” • Go back to Processing and select your code window. • Sketch > Add File.. • Navigate to ‘head.gif’ in Downloads and Open. • Confirm you have the image in your project: • Sketch > Show Sketch Folder
  • 9. Variables Draw the head Assign a value to the variable Centre the image on the mouse In Processing an image is a PImage This is the variable declaration
  • 11. The for loop for (INITIALIZE; TEST; INCREMENT) { ... } initialise loop variable, i i ‘less than’ n test increment i expression
  • 12. Relations < less than > greater than <= less than or equals >= greater than or equals != not equals == equals e.g. i < n
  • 13. low precedence high precedence Expressions * times / divide % modulo
 (remainder) + add - subtract multiplicative operators come first multiplicative operators come first multiplicative operators come first additive operators come second additive operators come second e.g. mouseY-25*(n-i) Use brackets to override precedence
  • 14. Co-ordinates x coordinate ycoordinate y increases as you move down the window origin In Processing it’s called a PVector An x,y coordinate is called a vector
  • 15. Arrays ERROR! p is empty Declare the array Initialise the array store mouse vector in array get earlier mouse vectors from array
  • 16. if (CONDITION) … else … if statement if statement checks that p is not empty Slow the frame-rate
  • 17. The Dragon’s Body • The image for the Dragon’s body is at: 
 http://stevebattle.github.io/dragon/body.gif • Save image to “Downloads” • Go back to Processing and select your code window. • Sketch > Add File.. • Navigate to ‘body.gif’ in Downloads and Open. • Confirm you have the image in your project: • Sketch > Show Sketch Folder
  • 18. Declare new variable load image display image