Monday, October 5, 2015

processing practice


PImage img;
float offset = 0;
float easing = 0.05;
 
void setup() {
  size(640, 360);
  img = loadImage("http://i.imgur.com/VG1jmqn.jpg");

 
}

void draw() {
  image(img, 0, 0);
  float dx = (mouseX-img.width/2) - offset;
  offset += dx * easing;
  tint(255, 127);
  image(img, offset, 0);
    
    }


   

void setup()
{
 
  size(600,600);
  background(0,255,0);

  for (int i=0; i<600; i+=10) //rectangles
  rect(i, 100, i+100,600);
 
  for(int i=0; i<600; i+=100) //left to right lines
    line(i, 100, i+100,600);
   
  for(int i=0; i<600; i+=100) //right to left lines
    line(i, 0, i-100,500);
   
  
   for (int i=0; i<600; i+=10) //bottom lines
   rect(i, 500, i+50,600);
  
   for(int i=0; i<600; i+=100) //left to right lines
    line(i, 100, i+100,600);


}

No comments:

Post a Comment