Task 1 and Task 2. Variables in Java Programs Variables start with lower case letter Variables are descriptive of what they store Variables are one word.

Slides:



Advertisements
Similar presentations
Image Processing … computing with and about data, … where "data" includes the values and relative locations of the colors that make up an image.
Advertisements

Game with US Beginner Tutorial. Welcome!! Who I am What is Processing? Basic Coding Input Methods Images Classes Arrays.
Variables and Operators
 Variables  What are they?  Declaring and initializing variables  Common uses for variables  Variables you get “for free” in Processing ▪ Aka: Built-in.
Data: Programming Design and Modularization IS 101Y/CMSC 101 Computational Thinking and Design Thursday, September 26, 2013 Marie desJardins University.
FUNDAMENTALS OF PROGRAMMING SM1204 Semester A 2011.
IAT 800 Lab 1: Loops, Animation, and Simple User Interaction.
ICM Week 2. Structure - statements and blocks of code Any single statement ends with semicolon ; When we want to bunch a few statements together we use.
Lecture 3 IAT 800. Sept 15, Fall 2006IAT 8002 Suggestions on learning to program  Spend a lot of time fiddling around with code –Programming is something.
PROCESSING Animation. Objectives Be able to create Processing animations Be able to create interactive Processing programs.
Review Blocks of code {.. A bunch of ‘statements’; } Structured programming Learning Processing: Slides by Don Smith 1.
Programming for Artists ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 10 Fall 2010.
More arrays Primitive vs. reference parameters. Arrays as parameters to functions.
______________________________________________________________________________________ SCHOOL OF INTERACTIVE ARTS + TECHNOLOGY [SIAT] |
Review Recursion Call Stack. Two-dimensional Arrays Visualized as a grid int[][] grays = {{0, 20, 40}, {60, 80, 100}, {120, 140, 160}, {180, 200, 220}};
Variables and Functions. Open your Encoder program Let’s begin by opening the “Labyrinth Auto Straight” code. Save this file as Labyrinth with variables.
Programming for Artists ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 10 Fall 2010.
CIS 3.5 Lecture 2.2 More programming with "Processing"
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
Lesson Two: Everything You Need to Know
Variables Art &Technology, 3rd Semester Aalborg University Programming David Meredith
Arrays. An array is a collection “The Dinner offers an array of choices.” In computer programming, an array is a collection of variables of the same data.
Mouse Inputs in Processing. Interacting with the Mouse mouseX and mouseY: pg mouseXmouseY –The position of the mouse in the canvas pmouseX and.
ITEC 109 Lecture 7 Operations. Review Variables / Methods Functions Assignments –Purpose? –What provides the data? –What stores the data? –What type of.
Chapter 2 Data abstraction: introductory concepts.
CSI 3125, Preliminaries, page 1 Data Type, Variables.
G RAPHICS & I NTERACTIVE P ROGRAMMING Lecture 2 More Programming with Processing.
Chapter One Lesson Three DATA TYPES ©
A: A: double “4” A: “34” 4.
Values, Types, and Variables. Values Data Information Numbers Text Pretty much anything.
Java – Variables and Constants By: Dan Lunney. Declaring Variables All variables must be declared before they can be used A declaration takes the form:
Files Review For output to a file: –FileOutputStream variable initialized to filename (String) and append/not append (boolean) –PrintWriter variable initialized.
 Variables can store data of different types, and different data types can do different things.  PHP supports the following data types:  String  Integer.
Data: Programming Design and Modularization IS 101Y/CMSC 101 Computational Thinking and Design Thursday, September 25, 2014 Carolyn Seaman Susan Martin.
 Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory. 
DATA TYPES, VARIABLES AND CONSTANTS. LEARNING OBJECTIVES  Be able to identify and explain the difference between data and information  Be able to identify,
Test Review. General Info. All tests will be comprehensive. You will be tested more on your understanding of code as opposed to your ability to write.
Programming for Art: Arrays – 2D ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 16 Fall 2010.
Processing Variables. Variables Processing gives us several variables to play with These variables are always being updated and you can assume they have.
Review Random numbers mouseX, mouseY setup() & draw() frameRate(), loop(), noLoop() Mouse and Keyboard interaction Arcs, curves, bézier curves, custom.
Introduction to Processing Dominique Thiebaut Dept. Computer Science Computer Science Dominique Thiebaut Thiebaut -- Computer Science.
CSE 110: Programming Language I Matin Saad Abdullah UB 1222.
Variables. Something to mention… void setup(){ size(200, 200); background(255); smooth(); } void draw() { stroke(0); strokeWeight(abs(mouseX-pmouseX));
CIS3931 – Intro to JAVA Lecture Note Set 2 17-May-05.
User Interaction and Variables
Lesson Two: Everything You Need to Know
Engineering Innovation Center
Basic Graphics Drawing Shapes 1.
Computation as an Expressive Medium
Review Operation Bingo
Examples of Primitive Values
For Net Art Lecture 2 J Parker
Chapter 10 Algorithms.
Mouse Inputs in Processing
Chapter 5, Conditionals Brief Notes
Chapter 10 Algorithms.
More programming with "Processing"
Pages:51-59 Section: Control1 : decisions
Control structures Chapter 3.
Control structures Chapter 3.
IAT 265 Lecture 2: Java Loops, Arrays Processing setup, draw, mouse Shapes Transformations, Push/Pop.
Control structures Chapter 3.
LCC 6310 Computation as an Expressive Medium
Lab1 Discussion B. Ramamurthy.
Chapter 10 Algorithms.
Chapter 4, Variables Brief Notes
Java: Variables, Input and Arrays
Pages:51-59 Section: Control1 : decisions
Variables and Operators
Data Types and Maths Programming Guides.
Presentation transcript:

Task 1 and Task 2

Variables in Java Programs Variables start with lower case letter Variables are descriptive of what they store Variables are one word Use camel case is two myRate; Data types - specifies the kind of data you are storing int - store whole number double - store decimals boolean - store true or false value

Creating Variables Refer to the data type - what it will store Whole number, decimal number, int data type stores whole numbers Integer double data type stores decimal numbers int numX = 40; double numY = 40.5;

Creating Variables int xSize = 400; int ySize = 400; size(xSize, ySize); There are two variables already created for you to use: mouseX - follows the mouseX location mouseY - follows the mouseY location Example: void draw() { ellipse(mouseX, mouseY, 40, 40); }

Methods We’ve used methods to create shapes. Processing has two main methods setup() where you set up the size of the sketch Initial information what needs to load once draw() This method is called continually. Allows for animation. Like a game loop.

Method random(int start, int end); returns a double Can produce random color Color is from 0 to 255 int r = (int)random(0,255); float r = random(0,255);

Create a program with variables void setup() { size(500, 500); } void draw() { ellipse(mouseX, mouseY, 40, 40); }

Processing has two main functions/methods: setup() The setup() function is called precisely once at the start of your program. void setup() { size(500, 500); } draw() - this method is called repeatedly like a game loop. an ellipse 40 pixels wide and 40 pixels high is drawn at the position of the mouse pointer, i.e. at location (mouseX, mouseY) on the screen.pixel mouseX and mouseY are examples of variables. These particular variables are pre-defined by Processing and are automatically set to be the current coordinates of the mouse pointer on the screen.variableProcessing void draw() { ellipse(mouseX, mouseY, 40, 40); }