Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float xoff = 0.0;
- float xincrement = 0.01;
- String text = "SkyLab";
- PFont font;
- Entity cercle1 = new Entity(100, 100, 20, 20);
- Entity cercle2 = new Entity(100, 250, 20, 20);
- float n;
- PImage sat;
- PImage logo;
- void setup() {
- //size(displayWidth, displayHeight);
- size(640, 360);
- background(0);
- noStroke();
- font = createFont("Gulim", 48, true);
- //sat = loadImage("satellite2.jpg");
- //sat.filter(GRAY);
- //sat.filter(INVERT);
- //sat.resize(50, 50);
- logo = loadImage("logo.png");
- logo.resize(300, 300);
- }
- void draw()
- {
- update();
- render();
- }
- void update() {
- //float n = random(0,width); // Try this line instead of noise
- // Get a noise value based on xoff and scale it according to the window's width
- if(mousePressed) {
- n = noise(xoff) * 64 * 2+32;
- } else {
- n = noise(xoff) * 32 * 2+32;
- }
- // With each cycle, increment xoff
- xoff += xincrement;
- cercle1.x = (int) (cos(xoff*5) * 150 + width/2);
- cercle1.y = (int) (sin(xoff*4) * 150 + height/2);
- cercle1.update();
- cercle2.x = (int) (cos(-xoff*3.5) * 150 + width/2);
- cercle2.y = (int) (sin(-xoff*4) * 150 + height/2);
- cercle2.update();
- }
- void render() {
- // Create an alpha blended background
- fill(color(0, sin(xoff*5)*10+100, cos(xoff*5)*10+100), 30);
- rect(0, 0, width, height);
- // SINUSOIDE ??
- fill(color(255, 255, 255));
- stroke(255);
- int pxx = 0;
- int pyy = height/2;
- for (int xx = 0; xx < width; xx+=5) {
- int yy = (int)(sin(xx+xoff*2)*100+height/2);
- point(xx, yy);
- pxx = xx;
- pyy = yy;
- }
- noStroke();
- //FIN SIN
- textFont(font, n);
- textAlign(CENTER);
- text(text, width/2, height/2);
- cercle1.render();
- cercle2.render();
- //image(sat, 0, 0);
- }
- boolean sketchFullScreen() {
- //return true;
- return false;
- }
- class Entity {
- int x, y, w, h;
- int vx = 0;
- int vy = 0;
- Entity() {
- x = 0;
- y = 0;
- w = 0;
- h = 0;
- }
- Entity(int x, int y, int w, int h) {
- this.x = x;
- this.y = y;
- this.w = w;
- this.h = h;
- }
- void update() {
- x += vx;
- y += vy;
- }
- void render() {
- fill(color(cos(xoff*5)*50+100,cos(xoff*5)*40+100,sin(xoff*5)*10+100));
- ellipse(x, y, w, h);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement