SlideShare a Scribd company logo
1 of 25
//


boolean pressed = false;
int count;

void setup()
{
  size(400,400);
  noStroke();
  colorMode(HSB,360,100,100,100);
  background(0);
}

void draw()
{
  if(pressed){
     fill(0,0,0,0.4);
     rect(0,0,width,height);
     fill(count%360,80,80,20);
     ellipse(mouseX, mouseY, 40, 40);
     ellipse(width-mouseX, mouseY, 40, 40);
     ellipse(mouseX, height-mouseY, 40, 40);
     ellipse(width-mouseX, height-mouseY, 40, 40);
  }
  count = count + 1;
}
void mousePressed()
{
  pressed = true;
}

void mouseReleased()
{
  pressed = false;
}
//


void setup()
{
  size(400, 400);
  noStroke();
  smooth();
}

void draw()
{
  background(0,0,0);
  fill(31,127,255,200);
  ellipse(mouseX, height/2, mouseY/3, mouseY/3);
  ellipse(width-mouseX,height/2,((height-mouseY)/3),((height-mouseY)/3));
}
//

boolean pressed = false;
int count;

void setup()
{
  size(400, 400);
  noStroke();
  colorMode(HSB,360,100,100,100);
  background(0);
  rectMode(CENTER);
}

void draw()
{
  if(pressed){
     fill(count%360,100,100,5);
     rect(mouseX, height/2, random(10,20), height);
  }
  count = count+1;
}
void mousePressed(){
  pressed = true;
}

void mouseReleased(){
  pressed = false;
}
//

float x, y;
float targetX, targetY;
float easing = 0.05;
boolean pressed = false;

void setup()
{
  size(400, 400);
  smooth();
  noStroke();
  background(0,0,0);
}

void draw()
{
  fill(0,0,0,10);
  rect(0,0,width,height);

     if(pressed){
        targetX = mouseX;
        targetY = mouseY;
     }
float dx = targetX - x;
    x += dx * easing;
    float dy = targetY - y;
    y += dy * easing;

    fill(31,127,255);
    ellipse(x, y, 33, 33);
}

void mousePressed()
{
  pressed = true;
}

void mouseReleased()
{
  pressed = false;
}
//

int NUM = 400;
float[] x = new float[NUM];
float[] y = new float[NUM];
float[] targetX = new float[NUM];
float[] targetY = new float[NUM];
float easing = 0.05;
boolean pressed = false;

void setup()
{
  size(400, 400);
  smooth();
  noStroke();
  background(0,0,0);
  for(int i=0; i<NUM; i++){
     x[i] = targetX[i] = random(width);
     y[i] = targetY[i] = random(height);
  }
}

void draw()
{
  fill(0,0,0,10);
for(int i=0; i<NUM; i++){
       if(pressed){
          targetX[i] = mouseX;
          targetY[i] = mouseY;
       }

        float dx = targetX[i] - x[i];
        x[i] += dx * easing;
        float dy = targetY[i] - y[i];
        y[i] += dy * easing;

        fill(31,127,255,40);
        ellipse(x[i], y[i], 20, 20);
    }
}

void mousePressed()
{
  pressed = true;
}

void mouseReleased()
{
  pressed = false;
  for(int i=0; i<NUM; i++){
void mouseReleased()
{
  pressed = false;
  for(int i=0; i<NUM; i++){
     targetX[i] = random(width);
     targetY[i] = random(height);
  }
}
Kwp2 100121

More Related Content

What's hot

Programa expresiones regulares
Programa expresiones regularesPrograma expresiones regulares
Programa expresiones regularesAnel Sosa
 
[3] 프로세싱과 아두이노
[3] 프로세싱과 아두이노[3] 프로세싱과 아두이노
[3] 프로세싱과 아두이노Chiwon Song
 
PYTHON PROGRAMS FOR BEGINNERS
PYTHON PROGRAMS FOR BEGINNERSPYTHON PROGRAMS FOR BEGINNERS
PYTHON PROGRAMS FOR BEGINNERSJEETPRATAPSINGH
 
Plot3D Package and Example in R.-Data visualizat,on
Plot3D Package and Example in R.-Data visualizat,onPlot3D Package and Example in R.-Data visualizat,on
Plot3D Package and Example in R.-Data visualizat,onDr. Volkan OBAN
 
Introduction to Generative Art with Processing
Introduction to Generative Art with ProcessingIntroduction to Generative Art with Processing
Introduction to Generative Art with Processingstefk00
 
Creative Coding 1 - 1 Introduction
Creative Coding 1 - 1 IntroductionCreative Coding 1 - 1 Introduction
Creative Coding 1 - 1 IntroductionTill Nagel
 
Visual Basic
Visual BasicVisual Basic
Visual BasicVj NiroSh
 
ARTDM 170, Week13: Processing
ARTDM 170, Week13: ProcessingARTDM 170, Week13: Processing
ARTDM 170, Week13: ProcessingGilbert Guerrero
 
Place Value
Place ValuePlace Value
Place Valuemansuk
 
Processing iii
Processing iiiProcessing iii
Processing iiicitylore
 
Find the output of the following code (Java for ICSE)
Find the output of the following code (Java for ICSE)Find the output of the following code (Java for ICSE)
Find the output of the following code (Java for ICSE)Mokshya Priyadarshee
 
Master Thesis presentation
Master Thesis presentationMaster Thesis presentation
Master Thesis presentationMajid Hajibaba
 

What's hot (17)

Programa expresiones regulares
Programa expresiones regularesPrograma expresiones regulares
Programa expresiones regulares
 
[3] 프로세싱과 아두이노
[3] 프로세싱과 아두이노[3] 프로세싱과 아두이노
[3] 프로세싱과 아두이노
 
Include
IncludeInclude
Include
 
PYTHON PROGRAMS FOR BEGINNERS
PYTHON PROGRAMS FOR BEGINNERSPYTHON PROGRAMS FOR BEGINNERS
PYTHON PROGRAMS FOR BEGINNERS
 
Plot3D Package and Example in R.-Data visualizat,on
Plot3D Package and Example in R.-Data visualizat,onPlot3D Package and Example in R.-Data visualizat,on
Plot3D Package and Example in R.-Data visualizat,on
 
Introduction to Generative Art with Processing
Introduction to Generative Art with ProcessingIntroduction to Generative Art with Processing
Introduction to Generative Art with Processing
 
Creative Coding 1 - 1 Introduction
Creative Coding 1 - 1 IntroductionCreative Coding 1 - 1 Introduction
Creative Coding 1 - 1 Introduction
 
Seg code
Seg codeSeg code
Seg code
 
Visual Basic
Visual BasicVisual Basic
Visual Basic
 
Day 3 examples
Day 3 examplesDay 3 examples
Day 3 examples
 
ARTDM 170, Week13: Processing
ARTDM 170, Week13: ProcessingARTDM 170, Week13: Processing
ARTDM 170, Week13: Processing
 
Place Value
Place ValuePlace Value
Place Value
 
Introduction to Processing
Introduction to ProcessingIntroduction to Processing
Introduction to Processing
 
Processing iii
Processing iiiProcessing iii
Processing iii
 
Advanced Concepts in Python
Advanced Concepts in PythonAdvanced Concepts in Python
Advanced Concepts in Python
 
Find the output of the following code (Java for ICSE)
Find the output of the following code (Java for ICSE)Find the output of the following code (Java for ICSE)
Find the output of the following code (Java for ICSE)
 
Master Thesis presentation
Master Thesis presentationMaster Thesis presentation
Master Thesis presentation
 

Similar to Kwp2 100121

ARTDM 170, Week10: Arrays + Using Randomization
ARTDM 170, Week10: Arrays + Using RandomizationARTDM 170, Week10: Arrays + Using Randomization
ARTDM 170, Week10: Arrays + Using RandomizationGilbert Guerrero
 
Artdm170 Week10 Arrays Math
Artdm170 Week10 Arrays MathArtdm170 Week10 Arrays Math
Artdm170 Week10 Arrays MathGilbert Guerrero
 
ARTDM 170, Week 13: Text Elements + Arrays
ARTDM 170, Week 13: Text Elements + ArraysARTDM 170, Week 13: Text Elements + Arrays
ARTDM 170, Week 13: Text Elements + ArraysGilbert Guerrero
 
Processing ii
Processing iiProcessing ii
Processing iicitylore
 
Exploring Canvas
Exploring CanvasExploring Canvas
Exploring CanvasKevin Hoyt
 
Creative Coding 1 - 2 Variables
Creative Coding 1 - 2 VariablesCreative Coding 1 - 2 Variables
Creative Coding 1 - 2 VariablesTill Nagel
 
Creating an Uber Clone - Part VIII - Transcript.pdf
Creating an Uber Clone - Part VIII - Transcript.pdfCreating an Uber Clone - Part VIII - Transcript.pdf
Creating an Uber Clone - Part VIII - Transcript.pdfShaiAlmog1
 
かとうの Kotlin 講座 こってり版
かとうの Kotlin 講座 こってり版かとうの Kotlin 講座 こってり版
かとうの Kotlin 講座 こってり版Yutaka Kato
 
c++ code#include iostream#include string#include stdlib.h.pdf
c++ code#include iostream#include string#include stdlib.h.pdfc++ code#include iostream#include string#include stdlib.h.pdf
c++ code#include iostream#include string#include stdlib.h.pdfapexjaipur
 

Similar to Kwp2 100121 (14)

Kwp2 100114
Kwp2 100114Kwp2 100114
Kwp2 100114
 
Proga 0608
Proga 0608Proga 0608
Proga 0608
 
ARTDM 170, Week10: Arrays + Using Randomization
ARTDM 170, Week10: Arrays + Using RandomizationARTDM 170, Week10: Arrays + Using Randomization
ARTDM 170, Week10: Arrays + Using Randomization
 
Artdm170 Week10 Arrays Math
Artdm170 Week10 Arrays MathArtdm170 Week10 Arrays Math
Artdm170 Week10 Arrays Math
 
ARTDM 170, Week 13: Text Elements + Arrays
ARTDM 170, Week 13: Text Elements + ArraysARTDM 170, Week 13: Text Elements + Arrays
ARTDM 170, Week 13: Text Elements + Arrays
 
Processing ii
Processing iiProcessing ii
Processing ii
 
Proga 0622
Proga 0622Proga 0622
Proga 0622
 
Exploring Canvas
Exploring CanvasExploring Canvas
Exploring Canvas
 
Creative Coding 1 - 2 Variables
Creative Coding 1 - 2 VariablesCreative Coding 1 - 2 Variables
Creative Coding 1 - 2 Variables
 
Creating an Uber Clone - Part VIII - Transcript.pdf
Creating an Uber Clone - Part VIII - Transcript.pdfCreating an Uber Clone - Part VIII - Transcript.pdf
Creating an Uber Clone - Part VIII - Transcript.pdf
 
Sbaw090623
Sbaw090623Sbaw090623
Sbaw090623
 
Of class2
Of class2Of class2
Of class2
 
かとうの Kotlin 講座 こってり版
かとうの Kotlin 講座 こってり版かとうの Kotlin 講座 こってり版
かとうの Kotlin 講座 こってり版
 
c++ code#include iostream#include string#include stdlib.h.pdf
c++ code#include iostream#include string#include stdlib.h.pdfc++ code#include iostream#include string#include stdlib.h.pdf
c++ code#include iostream#include string#include stdlib.h.pdf
 

Kwp2 100121

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11. // boolean pressed = false; int count; void setup() { size(400,400); noStroke(); colorMode(HSB,360,100,100,100); background(0); } void draw() { if(pressed){ fill(0,0,0,0.4); rect(0,0,width,height); fill(count%360,80,80,20); ellipse(mouseX, mouseY, 40, 40); ellipse(width-mouseX, mouseY, 40, 40); ellipse(mouseX, height-mouseY, 40, 40); ellipse(width-mouseX, height-mouseY, 40, 40); } count = count + 1; }
  • 12. void mousePressed() { pressed = true; } void mouseReleased() { pressed = false; }
  • 13.
  • 14. // void setup() { size(400, 400); noStroke(); smooth(); } void draw() { background(0,0,0); fill(31,127,255,200); ellipse(mouseX, height/2, mouseY/3, mouseY/3); ellipse(width-mouseX,height/2,((height-mouseY)/3),((height-mouseY)/3)); }
  • 15.
  • 16. // boolean pressed = false; int count; void setup() { size(400, 400); noStroke(); colorMode(HSB,360,100,100,100); background(0); rectMode(CENTER); } void draw() { if(pressed){ fill(count%360,100,100,5); rect(mouseX, height/2, random(10,20), height); } count = count+1; }
  • 17. void mousePressed(){ pressed = true; } void mouseReleased(){ pressed = false; }
  • 18.
  • 19. // float x, y; float targetX, targetY; float easing = 0.05; boolean pressed = false; void setup() { size(400, 400); smooth(); noStroke(); background(0,0,0); } void draw() { fill(0,0,0,10); rect(0,0,width,height); if(pressed){ targetX = mouseX; targetY = mouseY; }
  • 20. float dx = targetX - x; x += dx * easing; float dy = targetY - y; y += dy * easing; fill(31,127,255); ellipse(x, y, 33, 33); } void mousePressed() { pressed = true; } void mouseReleased() { pressed = false; }
  • 21.
  • 22. // int NUM = 400; float[] x = new float[NUM]; float[] y = new float[NUM]; float[] targetX = new float[NUM]; float[] targetY = new float[NUM]; float easing = 0.05; boolean pressed = false; void setup() { size(400, 400); smooth(); noStroke(); background(0,0,0); for(int i=0; i<NUM; i++){ x[i] = targetX[i] = random(width); y[i] = targetY[i] = random(height); } } void draw() { fill(0,0,0,10);
  • 23. for(int i=0; i<NUM; i++){ if(pressed){ targetX[i] = mouseX; targetY[i] = mouseY; } float dx = targetX[i] - x[i]; x[i] += dx * easing; float dy = targetY[i] - y[i]; y[i] += dy * easing; fill(31,127,255,40); ellipse(x[i], y[i], 20, 20); } } void mousePressed() { pressed = true; } void mouseReleased() { pressed = false; for(int i=0; i<NUM; i++){
  • 24. void mouseReleased() { pressed = false; for(int i=0; i<NUM; i++){ targetX[i] = random(width); targetY[i] = random(height); } }