initial commit
This commit is contained in:
15
index.php
Normal file
15
index.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<script language="javascript" type="text/javascript" src="p5.min.js"></script>
|
||||
<script language="javascript" type="text/javascript" src="p5.dom.min.js"></script>
|
||||
<script language="javascript" type="text/javascript" src="p5.sound.min.js"></script>
|
||||
<script language="javascript" type="text/javascript" src="save-the-earth.js"></script>
|
||||
<style>
|
||||
body {background:none transparent; position:fixed; top:0px; left:0px; bottom:0px; right:0px; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:1;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
61
save-the-earth.js
Normal file
61
save-the-earth.js
Normal file
@@ -0,0 +1,61 @@
|
||||
function preload() {
|
||||
levelSound = loadSound('sound.ogg');
|
||||
img = loadImage('Golden-Round-Frame-PNG.png');
|
||||
imgMask = loadImage('mask.png');
|
||||
|
||||
earthVideo = createVideo(['video.webm']);
|
||||
}
|
||||
var img, imgMask;
|
||||
var earthVideo;
|
||||
var levelSound;
|
||||
var continueBut;
|
||||
var frameSize;
|
||||
var label = "Click to save the earth.";
|
||||
var f = 0;
|
||||
var bg = 0;
|
||||
var nullifyFill = 1;
|
||||
var rotator = 0;
|
||||
var clicked = false;
|
||||
|
||||
function mouseClicked() {
|
||||
if(!clicked){
|
||||
clicked = true;
|
||||
levelSound.play();
|
||||
label = "Earth saved.";
|
||||
earthVideo.loop();
|
||||
}
|
||||
}
|
||||
|
||||
function setup() {
|
||||
frameSize = min(parent.innerWidth, parent.innerHeight);
|
||||
//createCanvas(window.innerWidth,window.innerHeight);
|
||||
createCanvas(frameSize,frameSize);
|
||||
frameRate(30);
|
||||
textSize(frameSize/14);
|
||||
textStyle(BOLD);
|
||||
textAlign(CENTER);
|
||||
imageMode(CENTER);
|
||||
stroke(77);
|
||||
strokeWeight(1);
|
||||
earthVideo.hide();
|
||||
earthVideo.loop();
|
||||
}
|
||||
|
||||
|
||||
function draw() {
|
||||
clear();
|
||||
earthVideo.mask(imgMask);
|
||||
image(earthVideo,frameSize/2,frameSize/2,frameSize/1.777,frameSize/1.777);
|
||||
if(clicked){
|
||||
push();
|
||||
translate(frameSize/2,frameSize/2);
|
||||
rotate(rotator);
|
||||
image(img,0,0,frameSize,frameSize);
|
||||
pop()
|
||||
fill(250,230,80);
|
||||
rotator+=0.01;
|
||||
} else {
|
||||
fill(255);
|
||||
}
|
||||
text(label, frameSize/2,frameSize/2);
|
||||
}
|
||||
Reference in New Issue
Block a user