Transparent baby, fade out approval video, comments

This commit is contained in:
MatMasIt 2021-11-20 12:07:13 +01:00
parent 5f04fd1e22
commit 4a9f1ad2ed
3 changed files with 40 additions and 24 deletions

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

View File

@ -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>

View File

@ -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,11 +20,12 @@ 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();
@ -89,6 +92,7 @@ function displayQuestion() {
// comrad Dwaynes feedback ************************* // comrad Dwaynes feedback *************************
$(".ans").mouseenter(function () { $(".ans").mouseenter(function () {
try {
var res = cQuestion["answers"][$(this).attr("data-ans") - 1]["effect"]; var res = cQuestion["answers"][$(this).attr("data-ans") - 1]["effect"];
if ((total <= 4000) && (res < 0)) { if ((total <= 4000) && (res < 0)) {
@ -97,9 +101,13 @@ $(".ans").mouseenter(function(){
$("#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 () {
try {
var res = cQuestion["answers"][$(this).attr("data-ans") - 1]["effect"]; var res = cQuestion["answers"][$(this).attr("data-ans") - 1]["effect"];
if ((total <= 4000) && (res < 0)) { if ((total <= 4000) && (res < 0)) {
@ -108,6 +116,10 @@ $(".ans").mouseleave(function(){
$("#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();
})