Advertisement
Guest User

çatouuuurnee!!

a guest
Nov 23rd, 2014
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.26 KB | None | 0 0
  1.  
  2. float xoff = 0.0;
  3. float xincrement = 0.01;
  4. String text = "SkyLab";
  5. PFont font;
  6. Entity cercle1 = new Entity(100, 100, 20, 20);
  7. Entity cercle2 = new Entity(100, 250, 20, 20);
  8. float n;
  9.  
  10. PImage sat;
  11. PImage logo;
  12.  
  13. void setup() {
  14.   //size(displayWidth, displayHeight);
  15.   size(640, 360);
  16.   background(0);
  17.   noStroke();
  18.   font = createFont("Gulim", 48, true);
  19.   //sat = loadImage("satellite2.jpg");
  20.   //sat.filter(GRAY);
  21.   //sat.filter(INVERT);
  22.   //sat.resize(50, 50);
  23.  
  24.   logo = loadImage("logo.png");
  25.   logo.resize(300, 300);
  26. }
  27.  
  28. void draw()
  29. {
  30.   update();
  31.   render();
  32. }
  33.  
  34. void update() {
  35.   //float n = random(0,width);  // Try this line instead of noise
  36.  
  37.     // Get a noise value based on xoff and scale it according to the window's width
  38.  
  39.  
  40.   if(mousePressed) {
  41.     n = noise(xoff) * 64 * 2+32;
  42.   } else {
  43.     n = noise(xoff) * 32 * 2+32;
  44.   }
  45.  
  46.   // With each cycle, increment xoff
  47.   xoff += xincrement;
  48.  
  49.   cercle1.x = (int) (cos(xoff*5) * 150 + width/2);
  50.   cercle1.y = (int) (sin(xoff*4) * 150 + height/2);
  51.   cercle1.update();
  52.   cercle2.x = (int) (cos(-xoff*3.5) * 150 + width/2);
  53.   cercle2.y = (int) (sin(-xoff*4) * 150 + height/2);
  54.   cercle2.update();
  55. }
  56. void render() {
  57.   // Create an alpha blended background
  58.   fill(color(0, sin(xoff*5)*10+100, cos(xoff*5)*10+100), 30);
  59.  
  60.   rect(0, 0, width, height);
  61.  
  62.   // SINUSOIDE ??
  63.  
  64.   fill(color(255, 255, 255));
  65.   stroke(255);
  66.  
  67.   int pxx = 0;
  68.   int pyy = height/2;
  69.   for (int xx = 0; xx < width; xx+=5) {
  70.     int yy = (int)(sin(xx+xoff*2)*100+height/2);
  71.  
  72.     point(xx, yy);
  73.  
  74.     pxx = xx;
  75.     pyy = yy;
  76.   }
  77.  
  78.   noStroke();
  79.   //FIN SIN
  80.  
  81.   textFont(font, n);
  82.   textAlign(CENTER);
  83.   text(text, width/2, height/2);
  84.  
  85.   cercle1.render();
  86.   cercle2.render();
  87.  
  88.   //image(sat, 0, 0);
  89. }
  90.  
  91. boolean sketchFullScreen() {
  92.   //return true;
  93.   return false;
  94. }
  95.  
  96.  
  97. class Entity {
  98.  
  99.   int x, y, w, h;
  100.   int vx = 0;
  101.   int vy = 0;
  102.  
  103.  
  104.   Entity() {
  105.     x = 0;
  106.     y = 0;
  107.     w = 0;
  108.     h = 0;
  109.   }
  110.   Entity(int x, int y, int w, int h) {
  111.     this.x = x;
  112.     this.y = y;
  113.     this.w = w;
  114.     this.h = h;
  115.   }
  116.   void update() {
  117.     x += vx;
  118.     y += vy;
  119.   }
  120.   void render() {
  121.     fill(color(cos(xoff*5)*50+100,cos(xoff*5)*40+100,sin(xoff*5)*10+100));
  122.     ellipse(x, y, w, h);
  123.   }
  124. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement