100% found this document useful (1 vote)
7 views18 pages

Processing Color and Image Tutorial

The document provides examples of Processing code for different tasks like drawing shapes, images, animation and saving frames. It demonstrates how to use variables, functions, conditionals, loops, libraries and more. Code snippets are presented with explanations and suggestions to modify aspects like values, coordinates, functions and libraries to experiment with different effects.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
7 views18 pages

Processing Color and Image Tutorial

The document provides examples of Processing code for different tasks like drawing shapes, images, animation and saving frames. It demonstrates how to use variables, functions, conditionals, loops, libraries and more. Code snippets are presented with explanations and suggestions to modify aspects like values, coordinates, functions and libraries to experiment with different effects.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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("[Link]");
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 [Link]");
image (img,0,0);
}
void draw(){
PImage abelha;
abelha = loadImage ("[Link]");
image (abelha, mouseX, mouseY, mouseX, mouseY);
}

PImage img;
PImage abelha;

void setup(){
size(900,529);
background(0);
}
void draw(){
PImage img;
img = loadImage("novos [Link]");
image (img,0,0);
PImage abelha;
abelha = loadImage ("[Link]");
image (abelha, mouseX, mouseY, mouseX, mouseY);
}

PImage img;
PImage abelha;

void setup(){
size(900,529);
background(0);
}
void draw(){
PImage img;
img = loadImage("novos [Link]");
image (img,0,0);
PImage abelha;
abelha = loadImage ("[Link]");
image (abelha, mouseX, mouseY, 100, 100);
}

PImage img;
PImage abelha;

void setup(){
size(900,529);
background(0);
}
void draw(){
PImage img;
img = loadImage("novos [Link]");
image (img,0,0);
PImage abelha;
abelha = loadImage ("[Link]");
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 < [Link]; 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 [Link].*;
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:


[Link]

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

[Link]

You might also like