Transparent baby, fade out approval video, comments
This commit is contained in:
parent
5f04fd1e22
commit
4a9f1ad2ed
BIN
assets/img/bbchacha.gif
Executable file → Normal file
BIN
assets/img/bbchacha.gif
Executable file → Normal file
Binary file not shown.
Before Width: | Height: | Size: 223 KiB After Width: | Height: | Size: 249 KiB |
|
@ -43,7 +43,7 @@
|
||||||
<img src="assets/img/play.png">
|
<img src="assets/img/play.png">
|
||||||
</div>
|
</div>
|
||||||
<div id="rock-approves" class="floatleft">
|
<div id="rock-approves" class="floatleft">
|
||||||
<video id="rock-approves-video" style="width: 100%;" muted>
|
<video id="rock-approves-video" style="width: 100%;" muted class="fadeOutVideo">
|
||||||
<source src="assets/video/aprovar.mp4" type="video/mp4">
|
<source src="assets/video/aprovar.mp4" type="video/mp4">
|
||||||
</video>
|
</video>
|
||||||
</div>
|
</div>
|
||||||
|
|
56
js/main.js
56
js/main.js
|
@ -1,11 +1,13 @@
|
||||||
var audio, audiostate;
|
var audio, audiostate;
|
||||||
var d = Math.random();
|
var d = Math.random();
|
||||||
|
// choose random bgm to start
|
||||||
if (d < 0.50) {
|
if (d < 0.50) {
|
||||||
audiostate = "mix";
|
audiostate = "mix";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
audiostate = "maobgm";
|
audiostate = "maobgm";
|
||||||
}
|
}
|
||||||
|
//handles bgm files to create a continous bgm
|
||||||
function audiosegm() {
|
function audiosegm() {
|
||||||
if (audiostate != "mix") {
|
if (audiostate != "mix") {
|
||||||
audio = new Audio('assets/music/main.mp3');
|
audio = new Audio('assets/music/main.mp3');
|
||||||
|
@ -18,13 +20,14 @@ function audiosegm() {
|
||||||
audio.play();
|
audio.play();
|
||||||
audio.onended = audiosegm;
|
audio.onended = audiosegm;
|
||||||
}
|
}
|
||||||
|
// plays a sound effect
|
||||||
function sef(filename) {
|
function sef(filename) {
|
||||||
new Audio("assets/music/" + filename + ".mp3").play();
|
new Audio("assets/music/" + filename + ".mp3").play();
|
||||||
}
|
}
|
||||||
$("#playBegin").click(function () {
|
$("#playBegin").click(function () {
|
||||||
try {
|
try {// this might fail, expecially on safari
|
||||||
document.getElementsByTagName("html")[0].requestFullscreen();
|
document.getElementsByTagName("html")[0].requestFullscreen();
|
||||||
} catch(e){}
|
} catch (e) { }
|
||||||
audiosegm();
|
audiosegm();
|
||||||
$(this).fadeOut();
|
$(this).fadeOut();
|
||||||
});
|
});
|
||||||
|
@ -51,17 +54,17 @@ function displayQuestion() {
|
||||||
var index = 0;
|
var index = 0;
|
||||||
|
|
||||||
// sends comrad Dwayne to help (or calls him back)
|
// sends comrad Dwayne to help (or calls him back)
|
||||||
if (total > 4000 ) { // comes when low score
|
if (total > 4000) { // comes when low score
|
||||||
$("#rock-approves").hide();
|
$("#rock-approves").hide();
|
||||||
$("#rock-disapproves").hide();
|
$("#rock-disapproves").hide();
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
$("#rock-approves-video").get(0).currentTime = 0;
|
$("#rock-approves-video").get(0).currentTime = 0;
|
||||||
$("#rock-approves").show();
|
$("#rock-approves").show();
|
||||||
}
|
}
|
||||||
// **************************************
|
// **************************************
|
||||||
// sends comrad baby cha-cha to help (or calls him back)
|
// sends comrad baby cha-cha to help (or calls him back)
|
||||||
if ( indexesProgress != 0 ) // comes when first question
|
if (indexesProgress != 0) // comes when first question
|
||||||
$("#bbchacha").hide();
|
$("#bbchacha").hide();
|
||||||
else
|
else
|
||||||
$("#bbchacha").show();
|
$("#bbchacha").show();
|
||||||
|
@ -88,25 +91,34 @@ function displayQuestion() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// comrad Dwaynes feedback *************************
|
// comrad Dwaynes feedback *************************
|
||||||
$(".ans").mouseenter(function(){
|
$(".ans").mouseenter(function () {
|
||||||
var res = cQuestion["answers"][$(this).attr("data-ans") - 1]["effect"];
|
try {
|
||||||
|
var res = cQuestion["answers"][$(this).attr("data-ans") - 1]["effect"];
|
||||||
|
|
||||||
if ( ( total <= 4000 ) && ( res < 0 ) ) {
|
if ((total <= 4000) && (res < 0)) {
|
||||||
$("#rock-approves").hide();
|
$("#rock-approves").hide();
|
||||||
$("#rock-disapproves").show();
|
$("#rock-disapproves").show();
|
||||||
$("#rock-disapproves-video").get(0).currentTime = 0;
|
$("#rock-disapproves-video").get(0).currentTime = 0;
|
||||||
$("#rock-disapproves-video").get(0).play();
|
$("#rock-disapproves-video").get(0).play();
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
if (e instanceof TypeError) return true;
|
||||||
|
else throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
$(".ans").mouseleave(function(){
|
$(".ans").mouseleave(function () {
|
||||||
var res = cQuestion["answers"][$(this).attr("data-ans") - 1]["effect"];
|
try {
|
||||||
|
var res = cQuestion["answers"][$(this).attr("data-ans") - 1]["effect"];
|
||||||
|
|
||||||
if ( ( total <= 4000 ) && ( res < 0 ) ) {
|
if ((total <= 4000) && (res < 0)) {
|
||||||
$("#rock-disapproves").hide();
|
$("#rock-disapproves").hide();
|
||||||
$("#rock-approves").show();
|
$("#rock-approves").show();
|
||||||
$("#rock-approves-video").get(0).currentTime = 0;
|
$("#rock-approves-video").get(0).currentTime = 0;
|
||||||
$("#rock-approves-video").get(0).play();
|
$("#rock-approves-video").get(0).play();
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
if (e instanceof TypeError) return true;
|
||||||
|
else throw e;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// ***8888888************************************8
|
// ***8888888************************************8
|
||||||
|
@ -150,3 +162,7 @@ $(".ans").click(function () {
|
||||||
displayQuestion();
|
displayQuestion();
|
||||||
$("#correct").fadeOut();
|
$("#correct").fadeOut();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('.fadeOutVideo').on('ended', function () {
|
||||||
|
$(this).parent().fadeOut();
|
||||||
|
})
|
Loading…
Reference in New Issue
Block a user