Skip to content

Instantly share code, notes, and snippets.

@madbunnykim
Created February 7, 2018 23:13
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save madbunnykim/739d4fc40807a7b08f60a9f321361653 to your computer and use it in GitHub Desktop.
SomaTarot
let tarot1, tarot2, tarot3;
let videoXrandomizer = [0, 1, 2];
let covered1 = true;
let covered2 = true;
let covered3 = true;
let videos = [];
let selection = [];
function setup() {
createCanvas(windowWidth, windowHeight);
background(255);
tarot1 = createImg('somatarot.png');
tarot2 = createImg('somatarot.png');
tarot3 = createImg('somatarot.png');
videos[0] = createVideo('devil.mp4');
videos[0].loop();
videos[0].hide();
videos[1] = createVideo('hangedman.mp4');
videos[1].loop();
videos[1].hide();
videos[2] = createVideo('fool.mp4');
videos[2].loop();
videos[2].hide();
videos[3] = createVideo('death.mp4');
videos[3].loop();
videos[3].hide();
videos[4] = createVideo('hermit.mp4');
videos[4].loop();
videos[4].hide();
videos[5] = createVideo('moon.mp4');
videos[5].loop();
videos[5].hide();
shuffle(videos, true);
shuffle(videoXrandomizer, true);
}
function draw() {
imageMode(CENTER);
let v_width = min(width / 3, 300);
let v_height = v_width * 1.666;
image(videos[0], width / 6 + (videoXrandomizer[0] * width / 3), v_height / 2 + 100, min(width / 3, 300), v_height);
if (covered1) {
tarot1.show();
} else {
tarot1.hide();
}
tarot1.size(min(width / 3, 300) + 33, v_height + 33);
tarot1.position(width / 6 - v_width / 2 - 13, 0 + 83);
image(videos[1], width / 6 + (videoXrandomizer[1] * width / 3), v_height / 2 + 100, min(width / 3, 300), v_height);
if (covered2) {
tarot2.show();
} else {
tarot2.hide();
}
tarot2.size(min(width / 3, 300) + 33, v_height + 33);
tarot2.position(3 * width / 6 - v_width / 2 - 12, 0 + 83);
image(videos[2], width / 6 + (videoXrandomizer[2] * width / 3), v_height / 2 + 100, min(width / 3, 300), v_height);
if (covered3) {
tarot3.show();
} else {
tarot3.hide();
}
tarot3.size(min(width / 3, 300) + 33, v_height + 33);
tarot3.position(5 * width / 6 - v_width / 2 - 12, 0 + 83);
}
function mousePressed() {
if (mouseX > 0 && mouseX < width / 3 && covered1 == true) {
// console.log("hello");
covered1 = false;
} else if (mouseX > width / 3 && mouseX < 2 * width / 3 && covered2 == true) {
// console.log("hello");
covered2 = false;
} else if (mouseX > width / 3 && mouseX < 3 * width / 3 && covered3 == true) {
// console.log("hello");
covered3 = false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment