You are on page 1of 18

Tutorial Processing

Dbora Aita Gasparetto


Abril/2015

Escolhendo a cor

Tools
Color Selector
Copy
Paste no scketch

void setup() {
size (600,600);
}
void draw() {
background (180,200,20, 50);
stroke (100, 100, 30, 40);
strokeWeight(10);
line (mouseX,mouseY,width,height-mouseY);
}

void setup(){
size (600,600);
}
void draw(){
background( 100,200,200);
PFont fonte;
fonte=loadFont("AlexBrush-Regular-48.vlw");
textFont(fonte);
fill(255,255,255);
text("Here Comes the sun",100,100,mouseX/2,mouseY/2);
}

PImage img;
PImage abelha;

void setup(){
size(900,529);
background(0);
PImage img;
img = loadImage("novos rumos.jpg");
image (img,0,0);
}
void draw(){
PImage abelha;
abelha = loadImage ("abelha.png");
image (abelha, mouseX, mouseY, mouseX, mouseY);
}

PImage img;
PImage abelha;

void setup(){
size(900,529);
background(0);
}
void draw(){
PImage img;
img = loadImage("novos rumos.jpg");
image (img,0,0);
PImage abelha;
abelha = loadImage ("abelha.png");
image (abelha, mouseX, mouseY, mouseX, mouseY);
}

PImage img;
PImage abelha;

void setup(){
size(900,529);
background(0);
}
void draw(){
PImage img;
img = loadImage("novos rumos.jpg");
image (img,0,0);
PImage abelha;
abelha = loadImage ("abelha.png");
image (abelha, mouseX, mouseY, 100, 100);
}

PImage img;
PImage abelha;

void setup(){
size(900,529);
background(0);
}
void draw(){
PImage img;
img = loadImage("novos rumos.jpg");
image (img,0,0);
PImage abelha;
abelha = loadImage ("abelha.png");
image (abelha, mouseX, mouseY, random (20,80),random (20,80));
}
//Experimente colocar mouseX, mouseY nos valores 0,0 de image img

int angulo;
void setup(){
size (600,600);
background (#3A8D9B);
smooth();
}
void draw(){
girar();
ellipse(angulo,45,255,255);
fill(#FFF40D, 50);
stroke(#FF960D);
angulo++;
}
void girar(){
translate(width/2, height/2);
rotate (radians(angulo));
}

//experimente mover o background e exclu-lo


//mude o angulo para -//mude o translate para mouseX, mouseY
//acrescente angulos # no espao da ellipse, entre os
parenteses

loat my_num=0;
float r=0;
void setup(){
size(800,800);
}
void draw(){
fill(#F01D52,20);
rotate(r);
float x=0;
while(x<width){
point(width*noise(x/50,my_num),x);
stroke(255,random(50,100),100);
x=x+.5;
}
my_num=my_num+0.01;
r=r+0.02;
}

//mude o valor de r dentro do rotate


//mude o valor do stroke e do x
// acrescente o mouse x ou y no campo do stroke

float d = 20.0;
float speed = 1.0;
int direction = 1;
void setup() {
size(300, 300);
noStroke();
fill(255, 204);
}
void draw() {
background(0);
ellipse(0, 150, mouseX, mouseY);
ellipse(300, 150, mouseX, mouseY);
ellipse(150, 0, mouseY, mouseX);
ellipse(150, 300, mouseY, mouseX);
d += speed * direction;
if ((mouseY > width) || (mouseX < width/10)) {
direction = -direction;
}
}

boolean keyz[] = new boolean [4];


void setup() {
size(400, 400);
stroke(255,0,0);
strokeWeight(5);
smooth();
}
void draw() {
background(255);
for (int i = 0; i < keyz.length; i++) {
if (keyz[i]) {
line(i*100, height, width/2, height/2);
}
}
}
void keyPressed() {
if (key == 'v') keyz[0] = true;
if (key == 'i') keyz[1] = true;
if (key == 'd') keyz[2] = true;
if (key == 'a') keyz[3] = true;
}
void keyReleased() {
if (key == 'v') keyz[0] = false;
if (key == 'i') keyz[1] = false;
if (key == 'd') keyz[2] = false;
if (key == 'a') keyz[3] = false;
}

void setup(){
size(600,600);
smooth();
}

void draw(){
background(#09958D);
for(int i = 0; i < 20; i++) {
if (i<10) {
fill (0, 35, 40, 0);
}
else {
fill (100,100,100);
}
ellipse (i*20, 300, 20, 20);
}
}

void setup(){
size(640, 360, P3D);
background(0);
lights();
}
void draw(){
noStroke();
pushMatrix();
translate(130, height/2, 0);
rotateY(1.25);
rotateX(-0.4);
box(100);
popMatrix();
noFill();
stroke(255);
pushMatrix();
translate(500, height*0.35, -200);
sphere(280);
popMatrix();
}

Instalando libraries e exemplos

import processing.pdf.*;
boolean record;
void setup() {
size (600,600);
background (180,200,20, 50);
}
void draw() {
if (record) {
beginRecord(PDF, "frame-####.pdf");
}
stroke (100, 100, 30, 40);
strokeWeight(10);
line (mouseX,mouseY,width,height);
if (record) {
endRecord();
record = false;
}
}
// Use a keypress so thousands of files aren't created
void mousePressed() {
record = true;
}

//outros exemplos de salvar arquivos em pdf em:


http://processing.org/reference/libraries/pdf/

int x = 0;
void draw() {
background(204);
if (x < 100) {
line(x, 0, x, 100);
x = x + 1;
} else {
noLoop();
}
// Saves each frame as line-000001.jpg, line-000002.jpg, etc.
saveFrame("line-######.jpg");
}

http://www.learningprocessing.com/exercises/

You might also like