Advertisement
powerofsoul

don't show this to igor worst code quality ever :!!!!

Jul 20th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.55 KB | None | 0 0
  1.  
  2. public boolean grow=false;
  3. public int size=10;
  4. public float roatateSpeed = 1;
  5.  
  6. public int x=0;
  7. public int y=0;
  8. public PImage img;
  9. public int effect = 2;
  10.  
  11. void setup() {
  12.   size(500, 500);
  13.   background(0,0,0);
  14.   img = loadImage("C:\\Users\\nrfmunteanu\\Desktop\\dog.jpg");
  15.   frameRate(1000);
  16. }
  17.  
  18.  
  19. void draw() {
  20.   switch(effect){
  21.    case 0:
  22.      printForward();
  23.    break;
  24.    case 1:
  25.      printBackwards();
  26.    break;
  27.    case 2:
  28.      printSideWays();
  29.      break;
  30.   }
  31.  
  32.   if(mousePressed) {
  33.     background(0,0,0);
  34.     effect = effect == 2 ? 0: effect+1;
  35.    
  36.     x=-1;
  37.   }
  38.  
  39. }
  40.  
  41. PImage getPixel(int x, int y, int size){
  42.   return img.get(x, y, size, size);
  43. }
  44.  
  45. void printForward(){
  46.   if(x==-1) {
  47.    x=0;
  48.    y=0;
  49.   }
  50.   image(getPixel(x, y, size), x,y);
  51.   if(x >= width && y >= height){
  52.     background(0,0,0);
  53.     x=0;
  54.     y=0;
  55.   }
  56.   if(x == width){
  57.     y+= size;
  58.     x=0;
  59.   }else
  60.     x+=size;
  61. }
  62.  
  63. void printBackwards(){
  64.   if(x==-1) {
  65.    x=width;
  66.    y=height;
  67.   }
  68.   image(getPixel(x, y, size), x,y);
  69.  
  70.   if(x <= 0 && y<=0){
  71.     background(0,0,0);
  72.     x=width;
  73.     y=width;
  74.   }
  75.   if(x <= 0){
  76.     y-= size;
  77.     print (x +"\n");
  78.     x= width;
  79.    
  80.   }else
  81.   x-=size;
  82. }
  83. int x2=0;
  84. void printSideWays(){
  85.   if(x==-1) {
  86.    x=0;
  87.    y=0;
  88.    x2=width;
  89.   }
  90.   if(x==x2 && y >= height){
  91.     x=0;
  92.    y=0;
  93.    x2=width;
  94.    background(0,0,0);
  95.   }
  96.   image(getPixel(x, y, size), x,y);
  97.    image(getPixel(x2, y, size), x2,y);
  98.   if(x==x2){
  99.    x=0;
  100.    x2=width;
  101.    y+=size;
  102.   }else{
  103.    x+=size;
  104.    x2 -= size;
  105.   }
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement