THE MOON WINDOW

This may sounds very familiar to you, at least I always do this – keepĀ the download window active and stare at the screen, expecting my energy is making the download faster. Although there’s no science proving that it is helpful, we still do it again and again, believing the energy that can’t be seen. It is one of the rare moments that we can really being quiet and focusing on something in this modern digital world which full of fragments. And the motivation is to be faster. Yes, we are loosing patience. We can’t wait.

So this “electronic” ritual that I made is keep the window active to accelerate the moon phase happening. Moon is a sign of time. In earlier time, people watched the sky, told the time and fortune, and also sent their miss of family and lovers to the moon. But now, let’s don’t wait. Let’s make everthing faster, faster, and faster…

Here’s the prototype in p5js:


The codes in p5js

var windowImg, moonImg;

var x, y;
var overWindow = false;
var locked = false;
var xOffset = 0; 
var yOffset = 0; 
var a = 255;

var cX = 380;
var cY = 280;
var cSpeed = 0.05;

function setup() { 
 createCanvas(700, 500);
 windowImg = loadImage('window.png');
 moonImg = loadImage('moon.jpg');
 
 x = 0;
 y = 0;
} 

function draw() { 
 background(0);
 
 tint(255, 255);
 image(moonImg, 150, 40, moonImg.width/2, moonImg.height/2);
 noStroke();
 fill(0);
 ellipse(cX, cY, 340, 340);
 
 tint(255, a);
 image(windowImg, x, y, windowImg.width/2, windowImg.height/2);
 
 if ((mouseX > x) && 
 (mouseX < x+windowImg.width/2) && 
 (mouseY > y) &&
 (mouseY < y+windowImg.height/2)) {
 overWindow = true;
 if(!locked) { 
 if (cSpeed > 0.1){
 cSpeed -= 0.1;
 }
 } else {
 if (cSpeed < 3) {
 cSpeed += 0.05;
 }
 overWindow = false;
 a = 255;
 }
 }
 
 if (cX > 720) {
 cX = 380;
 }
 
 cX += cSpeed;
 
 if (a > 15) {
 a -= 1;
 }
}

function mousePressed() {
 if(overWindow) { 
 locked = true; 
 } else {
 locked = false;
 }
 xOffset = mouseX-x; 
 yOffset = mouseY-y; 
}

function mouseDragged() {
 if(locked) {
 x = mouseX-xOffset; 
 y = mouseY-yOffset; 
 }
}
 
function mouseReleased() {
 locked = false;
}

Leave a Reply

Your email address will not be published. Required fields are marked *