Programming in Processing Taught by Ms. Madsen Assistants: Ms. Fischer and Ms. Yen Winsor School, 2/6/08.

Slides:



Advertisements
Similar presentations
Noadswood Science,  To know how to use Python to produce windows and colours along with specified co-ordinates Sunday, April 12, 2015.
Advertisements

Programming in Processing Taught by Ms. Madsen Assistants: Ms. Fischer and Ms. Yen Winsor School, 2/13/08.
Game with US Beginner Tutorial. Welcome!! Who I am What is Processing? Basic Coding Input Methods Images Classes Arrays.
How Tags are used to form your Web Page
Variables Conditionals Loops The concept of Iteration Two types of loops: While For When do we use them? Iteration in the context of computer graphics.
10-Jun-15 Introduction to Primitives. 2 Overview Today we will discuss: The eight primitive types, especially int and double Declaring the types of variables.
Four simple expressions in meta. Data objects Pieces of data in a computer are called objects Today, we’ll talk about four kinds of objects Numbers Pictures.
1 A Simple Applet. 2 Applets and applications An application is an “ordinary” program Examples: Notepad, MS Word, Firefox, Halo, etc. An applet is a Java.
Introduction to Primitives. Overview Today we will discuss: –The eight primitive types, especially int and double –Declaring the types of variables –Operations.
Logo Lesson 5 TBE Fall 2004 Farah Fisher. Prerequisites  Given a shape, use basic Logo commands and/or a procedure to draw the shape, with and.
A Simple Applet. Applets and applications An applet is a Java program that runs on a web page –Applets can be run from: Internet Explorer Netscape Navigator.
Four simple expressions in meta. Data objects Pieces of data in a computer are called objects Today, we’ll talk about four kinds of objects Numbers Pictures.
A Simple Applet.
Modules Standard Modules. Standard Modules The Subs and Functions worked perfectly well where they were – inside the two lines “Public Class Form1” and.
Adding Controls to User Forms. Adding Controls A user form isn’t much use without some controls We’re going to add controls and write code for them Note.
Multiplication and Division Addition and Subtraction PracticeExponentsParenthesesHomeQuizIntroduction Objective and Standards Please Excuse My Dear Aunt.
Created by NW 2012 – please note all copyright on images used is property of copyright holder. Note: some of the more complicated descriptions are taken.
Classes / Objects An introduction to object-oriented programming.
Programming for Artists ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 10 Fall 2010.
Introduction to Programming with Java. Overview What are the tools we are using – What is Java? This is the language that you use to write your program.
Intro to Java & Processing. Review CS is about problem-solving CS is about problem-solving To write programs you must To write programs you must –Be able.
Shorter of two objects and changing color V2 Functions, events and setting the color in sequence and randomly This is a modification of the Changing Color.
More Basic HTML. Add spacing (single & double space) Save Refresh Add horizontal rule Add comments Add styles Add headings Add features Add alignments.
Instructor: Chris Trenkov Hands-on Course Python for Absolute Beginners (Spring 2015) Class #002 (January 17, 2015)
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
Introducing Scratch the Cat
Programming History. Who was the first programmer?
A way to pull together related data A Shape Class would contain the following data: x, y, height, width Then associate methods with that data A Shape.
 HTML is hypertext markup language. It is a way for people to display their information with more complex pictures and text displays. Before HTML, messages.
1 A Simple Applet. 2 Applets and applications An application is an “ordinary” program Examples: Notepad, MS Word, Firefox, Halo, etc. An applet is a Java.
Programming for Artists ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 10 Fall 2010.
Lawrence Snyder University of Washington, Seattle © Lawrence Snyder 2004 Assignment 6.
CONTROL SYSTEMS Control Systems A command is a directive that performs a specific task An argument is a variable that can be used by the function reveiving.
Graphic Basics in C ATS 315. The Graphics Window Will look something like this.
Aim: How do we multiply monomials and polynomials?
VARIABLES Programmes work by manipulating data placed in memory. The data can be numbers, text, objects, pointers to other memory areas, and more besides.
CSD 340 (Blum)1 Starting JavaScript Homage to the Homage to the Square.
CRE Programming Club - Class 2 Robert Eckstein and Robert Heard.
Lawrence Snyder University of Washington, Seattle © Lawrence Snyder 2004 Drawing pictures … It’s not art, it’s fun.
Lesson 2: Reading a program. Remember: from yesterday We learned about… Precise language is needed to program Actors and Classes Methods – step by step.
Python Let’s get started!.
1 A Simple Applet. 2 Applets and applications An applet is a Java program that runs on a web page Applets can be run within any modern browser To run.
 Columns  Rows  Cells  Ranges  Cell addresses  Column headers  Row headers  Formulas  Spreadsheet.
CRE Programming Club - Class 5 Robert Eckstein and Robert Heard.
Spiderman ©Marvel Comics Creating Web Pages (part 1)
To view this in “presentation” mode, go to Slide Show  View Show (the toolbar at the top of the page) Use the “Enter” key to advance to the next slide.
ENG College of Engineering Engineering Education Innovation Center 1 Functions 1 in MATLAB Topics Covered: 1.Uses of Functions Organizational Tool.
Java With NetBeans First Project. Java Are language for this semester is Java The Development Environment is Netbeans.
1 Taking Notes. 2 STOP! Have I checked all your Source cards yet? Do they have a yellow highlighter mark on them? If not, you need to finish your Source.
Rob Miles. Creating a Broken MoodLight An XNA game contains game data which is used by the Draw and Update methods – Update updates the game data – Draw.
Programming in Processing Taught by Ms. Madsen Assistants: Ms. Fischer and Ms. Yen Winsor School, 2/20/08.
CompSci 4 Java 4 Apr 14, 2009 Prof. Susan Rodger.
PROBLEM SOLVING WARM-UP Fill in the spaces using any operation to solve the following (!, (), -/+,÷,×): = 6.
what is computer programming?
Pixels, Colors and Shapes
Introduction to Python
UNIT 3 – LESSON 5 Creating Functions.
Learning to program with Logo
Introduction to Computers and Python
Ten Steps to a Good PowerPoint
Items, Group Boxes, Check Boxes & Radio Buttons
Introduction In today’s lesson we will look at: why Python?
Tonga Institute of Higher Education IT 141: Information Systems
Introduction to Primitives
Lawrence Snyder University of Washington, Seattle
Introduction to Primitives
Tonga Institute of Higher Education IT 141: Information Systems
creating a ecosystems model in net logo
Basic Processing … Drawing pictures … It’s not art, it’s fun
Chapter 1 Introducing Small Basic
Presentation transcript:

Programming in Processing Taught by Ms. Madsen Assistants: Ms. Fischer and Ms. Yen Winsor School, 2/6/08

Who are we? We’re MIT students. Ms. YenMs. Fischer Ms. Madsen

Why do we need programming? You think: “Hello World” The computer would think: HE L L O [space] W O R L D Please raise your hand now if you would like to take a class on typing 1s and 0s.

Nobody else wants to, either.

What’s the other choice? Instead, we use “programming languages” to talk to the computer. Just like other languages, you express ideas in different ways when using different programming languages. What are some foreign languages you can think of?

There are lots of programming languages, too. Here are some you might have heard of: Basic, Java, Javascript, Logo. Here are some you probably haven’t heard of before now: C++, Perl, Scheme, C#, Python, Lisp, Cobol, Fortran, Pascal, SQL, Haskell, J2EE, Maple, PHP, Ruby, Ubercode.

Where do you see programming in real life? Short answer: all over the place!

Here are some examples.

Getting Started We’re going to start by setting up our program. (Makes sense.) The method we use for this is called “setup()”.

(Hang on – what’s a method?) Our code is going to be organized like this: void setup(){ stuff that we are using to set up our window goes here. } void draw(){ stuff that we are drawing in our window goes here. } Think of methods as ways of organizing your information – like different boxes to hold different parts of code. setup()draw() These are commands you use to set up your program. These are commands you use to draw stuff.

Let’s type our methods into the Processing window now. Press this button to run your program. Your code goes here. On the next slide, I’ll show you what to type.

Let’s put our ‘boxes’ – the methods – into Processing now. void setup() { } void draw() { } These are “curly brackets” – we’ll use them a lot. You can find them next to the ‘p’ key. The first curly bracket means, ‘everything that goes in the box goes AFTER this bracket.’ The second one means, ‘everything that goes in the box must be in it already – this is the end of the box.’ When you see code in BLACK, type exactly what you see into Processing. You can put as many blank lines as you want here. DO NOT capitalize “void”, “draw”, or “setup”. They are all lower-case.

Now let’s put something in the setup() method. First, let’s set a size for our window. –Choose a width and a height. When you see something in GREEN, that means you should type a number instead of what’s written on the slide. For width and height, you might try something like 50 or 100 or 400… or 88, or 129, or 302. void setup() { size(width, height); } void draw() { }

That’s really exciting! But maybe we should add some color. In Processing, you create colors by telling the color how much Red, Green, and Blue to have. They can have some amount of each of those colors between 0 and 255.

Colors are formed like this: (Red, Green, Blue).

How do we use color? First, create a color. When you see text in blue, you should replace it with a name. –The name must start with a letter and can’t have any spaces. color colorName; Then, assign that color’s RGB values: colorName = color(redValue, greenValue, blueValue); Look at your handout for help remembering RGB colors.

Let’s add our “color” code. (add the underlined code. Don’t forget a semi-colon – ; – at the end of every command.) void setup() { size(width, height); color colorName; colorName = color(redValue, greenValue, blueValue); } void draw() { }

Hm. That wasn’t very interesting. Let’s add in something else… How about setting that color as our background? Easy! Just add this to setup(): background(colorName);

void setup() { size(width, height); color colorName; colorName = color(redValue, greenValue, blueValue); background(colorName); } void draw() { } Let’s add our “background” code. (add the underlined code. Don’t forget a semi-colon – ; – at the end of every command.)

Now let’s create a rectangle. The rectangle command, rect(), takes four arguments inside the parentheses, separated by commas. 1) xStart 2) yStart 3) width 4) height

What do these mean? #2: yStart #1: xStart #3: width #4: height rect(xStart, yStart, width, height);

void setup() { color colorName; colorName = color(redValue, greenValue, blueValue); background(colorName); size(width, height); } void draw() { rect(xStart, yStart, width, height); } Let’s add our “rect” code. (add the underlined code. Don’t forget a semi-colon – ; – at the end of every command.)

Now let’s create an oval. (In Processing, this is called an ‘ellipse’.) The oval command, ellipse(), takes four arguments inside the parentheses, separated by commas. 1) xStart 2) yStart 3) width 4) height

What do these mean? #3: width #4: height ellipse(xStart, yStart, width, height); #2: yStart #1: xStart

void setup() { color colorName; colorName = color(redValue, greenValue, blueValue); background(colorName); size(width, height); } void draw() { rect(xStart, yStart, width, height); ellipse(xStart, yStart, width, height); } Let’s add our “ellipse” code. (add the underlined code. Don’t forget a semi-colon – ; – at the end of every command.)