Compare commits

...
Sign in to create a new pull request.

1 commit
master ... dev

Author SHA1 Message Date
Omar Najjar
04ccf2fb00
Add files via upload 2021-11-13 18:53:53 +11:00
8 changed files with 481 additions and 0 deletions

21
Invention-Dice/LICENSE Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 Omar
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

36
Invention-Dice/index.html Normal file
View file

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>Invention Game Dice</title>
<meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="./style.css">
</head>
<body style="max-width: 100%; box-sizing: border-box; display: flex; align-items: center; justify-content: left; margin: 1em 5em; padding: 1em; " data-pen-title="Dice">
<!-- partial:index.partial.html -->
<!-- <h1 class="header">Invention Game</h1> -->
<!-- Shows a question mark whilst loading-->
<div>
<img src="https://bit.ly/dice-unknown" id="dice"/>
<img src="https://bit.ly/dice-unknown" id="dice2"/>
<img src="https://bit.ly/dice-unknown" id="dice3"/>
<img src="https://bit.ly/dice-unknown" id="dice4"/>
<img src="https://bit.ly/dice-unknown" id="dice5"/>
<img src="https://bit.ly/dice-unknown" id="dice6"/>
</div>
<!-- When you click the div, it executes rollThatDice()-->
<button onclick="rollThatDice()">Roll That Dice</button>
<!-- A link to the roll sound you hear-->
<audio src="https://bit.ly/dice-sound" id="audio"></audio>
<!-- partial -->
<script src="./script.js"></script>
</body>
</html>

View file

@ -0,0 +1,9 @@
Copyright (c) 2020 by omar (https://codepen.io/thecoderpenguin/pen/BaNVbLB)
Fork of an original work Dice (https://codepen.io/charliebritton/pen/RVyBLr
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

140
Invention-Dice/script.js Normal file
View file

@ -0,0 +1,140 @@
const diceFaces = [
"https://bit.ly/dice-unknown",
//MATERIAL - GREEN 1
//Plastic
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590748/Dice%20Faces%20on%20Online%20Invention%20Game/1%20Material/Material-100_x100-04_otlqe0.png",
//Edible
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590750/Dice%20Faces%20on%20Online%20Invention%20Game/1%20Material/Material-100_x100-05_zvsk8t.png",
//Organic
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590748/Dice%20Faces%20on%20Online%20Invention%20Game/1%20Material/Material-100_x100-06_jtuynm.png",
//Paper
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590749/Dice%20Faces%20on%20Online%20Invention%20Game/1%20Material/Material-100_x100-01_lgpdpl.png",
//Metal
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590748/Dice%20Faces%20on%20Online%20Invention%20Game/1%20Material/Material-100_x100-02_h97ipn.png",
//Wood
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590749/Dice%20Faces%20on%20Online%20Invention%20Game/1%20Material/Material-100_x100-03_f6w9bu.png",
//MOTIVE POWER - YELLOW 2
//Electric
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590776/Dice%20Faces%20on%20Online%20Invention%20Game/2%20Motive%20Power/Motive_Power-100_x_100-04_rvcd3o.png",
//Manual
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590758/Dice%20Faces%20on%20Online%20Invention%20Game/2%20Motive%20Power/Motive_Power-100_x_100-02_muxmmd.png",
//Solar
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590754/Dice%20Faces%20on%20Online%20Invention%20Game/2%20Motive%20Power/Motive_Power-100_x_100-06_kw9prf.png",
//Wind
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590758/Dice%20Faces%20on%20Online%20Invention%20Game/2%20Motive%20Power/Motive_Power-100_x_100-01_kybgt6.png",
//Water
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590758/Dice%20Faces%20on%20Online%20Invention%20Game/2%20Motive%20Power/Motive_Power-100_x_100-03_ssx7bc.png",
//Clockwork
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590768/Dice%20Faces%20on%20Online%20Invention%20Game/2%20Motive%20Power/Motive_Power-100_x_100-05_y76gqv.png",
//SCALE - BLUE 3
//Giant
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590753/Dice%20Faces%20on%20Online%20Invention%20Game/3%20Scale/Scale-100_x_100-06_fmp9rj.png",
//Pocket
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590755/Dice%20Faces%20on%20Online%20Invention%20Game/3%20Scale/Scale-100_x_100-02_xntwax.png",
//Mini
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590767/Dice%20Faces%20on%20Online%20Invention%20Game/3%20Scale/Scale-100_x_100-04_fsbfd0.png",
//Wearable
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590754/Dice%20Faces%20on%20Online%20Invention%20Game/3%20Scale/Scale-100_x_100-03_y2yxco.png",
//Inhabitable
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590756/Dice%20Faces%20on%20Online%20Invention%20Game/3%20Scale/Scale-100_x_100-05_s4vjxo.png",
//Portable
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590752/Dice%20Faces%20on%20Online%20Invention%20Game/3%20Scale/Scale-100_x_100-01_ofdxfv.png",
//DEVICE - PURPLE 4
//Art
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590766/Dice%20Faces%20on%20Online%20Invention%20Game/4%20Device/Device-100_x_100-01_bvtfug.png",
//Vehicle
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590763/Dice%20Faces%20on%20Online%20Invention%20Game/4%20Device/Device-100_x_100-06_l8rvl2.png",
//Tool
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590765/Dice%20Faces%20on%20Online%20Invention%20Game/4%20Device/Device-100_x_100-02_r45kvh.png",
//Game
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590766/Dice%20Faces%20on%20Online%20Invention%20Game/4%20Device/Device-100_x_100-03_acgh4f.png",
//Computer
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590761/Dice%20Faces%20on%20Online%20Invention%20Game/4%20Device/Device-100_x_100-05_u3tecx.png",
//Robot
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590763/Dice%20Faces%20on%20Online%20Invention%20Game/4%20Device/Device-100_x_100-04_jsaipy.png",
//CONSUMER - ORANGE 5
//Personal
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590751/Dice%20Faces%20on%20Online%20Invention%20Game/5%20Consumer/Consumer-_100_x_100-04_pviz0q.png",
//Home
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590751/Dice%20Faces%20on%20Online%20Invention%20Game/5%20Consumer/Consumer-_100_x_100-03_t52wbx.png",
//Public
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590752/Dice%20Faces%20on%20Online%20Invention%20Game/5%20Consumer/Consumer-_100_x_100-02_g3abxk.png",
//Family
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590754/Dice%20Faces%20on%20Online%20Invention%20Game/5%20Consumer/Consumer-_100_x_100-01_y81hzn.png",
//Office
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590751/Dice%20Faces%20on%20Online%20Invention%20Game/5%20Consumer/Consumer-_100_x_100-05_gqx2is.png",
//Industrial
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590751/Dice%20Faces%20on%20Online%20Invention%20Game/5%20Consumer/Consumer-_100_x_100-06_sedev8.png",
//ACTION - PINK 6
//Random
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590770/Dice%20Faces%20on%20Online%20Invention%20Game/6%20Action/Action-_100_x_100-03_fntt11.png",
//Flying
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590768/Dice%20Faces%20on%20Online%20Invention%20Game/6%20Action/Action-_100_x_100-02_fuzldi.png",
//Stealth
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590769/Dice%20Faces%20on%20Online%20Invention%20Game/6%20Action/Action-_100_x_100-05_qthdns.png",
//Underwater
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590768/Dice%20Faces%20on%20Online%20Invention%20Game/6%20Action/Action-_100_x_100-01_cnhils.png",
//Self-Build
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590770/Dice%20Faces%20on%20Online%20Invention%20Game/6%20Action/Action-_100_x_100-04_yqd2jy.png",
//Disposable
"https://res.cloudinary.com/dmnr5acns/image/upload/v1590590768/Dice%20Faces%20on%20Online%20Invention%20Game/6%20Action/Action-_100_x_100-06_lshxob.png"
];
for (const element of diceFaces) {
}
// Cleans up code later
var image = document.getElementById("dice");
var image2 = document.getElementById("dice2");
var image3 = document.getElementById("dice3");
var image4 = document.getElementById("dice4");
var image5 = document.getElementById("dice5");
var image6 = document.getElementById("dice6");
var audio = document.getElementById("audio");
// Gets a random integer, min & max inclusive
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function rollThatDice() {
audio.currentTime = 0;
image.style.animation = "spindice 0.25s";
image2.style.animation = "spindice 0.25s";
image3.style.animation = "spindice 0.25s";
image4.style.animation = "spindice 0.25s";
image5.style.animation = "spindice 0.25s";
image6.style.animation = "spindice 0.25s";
setTimeout(function () {
image.setAttribute("src", diceFaces[getRandomInt(1, 6)]);
image2.setAttribute("src", diceFaces[getRandomInt(7, 12)]);
image3.setAttribute("src", diceFaces[getRandomInt(13, 18)]);
image4.setAttribute("src", diceFaces[getRandomInt(19, 24)]);
image5.setAttribute("src", diceFaces[getRandomInt(25, 30)]);
image6.setAttribute("src", diceFaces[getRandomInt(31, 36)]);
}, 125);
setTimeout(function () {
image.style.animation = "none";
image2.style.animation = "none";
image3.style.animation = "none";
image4.style.animation = "none";
image5.style.animation = "none";
image6.style.animation = "none";
}, 250);
audio.play();
}
document.addEventListener("DOMContentLoaded", function (event) {
rollThatDice();
});

View file

@ -0,0 +1,15 @@
h1.header Invention Game
// Shows a question mark whilst loading
img(src="https://bit.ly/dice-unknown")#dice
img(src="https://bit.ly/dice-unknown")#dice2
img(src="https://bit.ly/dice-unknown")#dice3
img(src="https://bit.ly/dice-unknown")#dice4
img(src="https://bit.ly/dice-unknown")#dice5
img(src="https://bit.ly/dice-unknown")#dice6
// When you click the div, it executes rollThatDice()
div(onclick="rollThatDice()") Roll That Dice
// A link to the roll sound you hear
audio(src="https://bit.ly/dice-sound")#audio

View file

@ -0,0 +1,139 @@
const diceFaces = [
"https://bit.ly/dice-unknown",
//MATERIAL - RED 1
//Plastic
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616437/Material-100_x100-04_dznrm4.png",
//Edible
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616437/Material-100_x100-05_nze09o.png",
//Organic
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616437/Material-100_x100-06_lbz6ui.png",
//Paper
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616437/Material-100_x100-01_nxuwlk.png",
//Metal
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616436/Material-100_x100-02_tpybpi.png",
//Wood
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616436/Material-100_x100-03_aom9pj.png",
//MOTIVE POWER - YELLOW 2
//Electric
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616450/Motive_Power-100_x_100-04_ebwkeq.png",
//Manual
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616449/Motive_Power-100_x_100-02_oayuxs.png",
//Solar
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616449/Motive_Power-100_x_100-06_eauc07.png",
//Wind
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616449/Motive_Power-100_x_100-01_acbqgj.png",
//Water
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616449/Motive_Power-100_x_100-03_bwq3qy.png",
//Clockwork
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616449/Motive_Power-100_x_100-05_zwchd7.png",
//SCALE - GREEN 3
//Giant
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616384/Scale-100_x_100-06_iwbwvn.png",
//Pocket
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616383/Scale-100_x_100-02_kgtog5.png",
//Mini
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616383/Scale-100_x_100-04_jnqfws.png",
//Wearable
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616383/Scale-100_x_100-03_rdkcdn.png",
//Inhabitable
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616383/Scale-100_x_100-05_mi4kby.png",
//Portable
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616382/Scale-100_x_100-01_xwofbe.png",
//DEVICE - BLUE 4
//Art
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616396/Device-100_x_100-01_gp2scy.png",
//Vehicle
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616397/Device-100_x_100-06_tpee5i.png",
//Tool
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616397/Device-100_x_100-02_i1hlyf.png",
//Game
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616396/Device-100_x_100-03_qre686.png",
//Computer
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616396/Device-100_x_100-05_jfrffx.png",
//Robot
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616396/Device-100_x_100-04_kiyqbx.png",
//CONSUMER - ORANGE 5
//Personal
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616410/Consumer-_100_x_100-04_qtx1mp.png",
//Home
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616410/Consumer-_100_x_100-03_iq0dy3.png",
//Public
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616409/Consumer-_100_x_100-02_nm1poh.png",
//Family
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616409/Consumer-_100_x_100-01_po2icu.png",
//Office
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616409/Consumer-_100_x_100-05_f0exbj.png",
//Industrial
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616409/Consumer-_100_x_100-06_lwp6fp.png",
//ACTION - PINK 6
//Random
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616365/Action-_100_x_100-03_c3k2uh.png",
//Flying
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616365/Action-_100_x_100-02_waec4l.png",
//Stealth
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616365/Action-_100_x_100-05_uqaosl.png",
//Underwater
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616365/Action-_100_x_100-01_nxnewa.png",
//Self-Build
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616365/Action-_100_x_100-04_wzrwdg.png",
//Disposable
"https://res.cloudinary.com/dmnr5acns/image/upload/v1589616365/Action-_100_x_100-06_gqz9ys.png"
];
for (const element of diceFaces) {
}
// Cleans up code later
var image = document.getElementById("dice");
var image2 = document.getElementById("dice2");
var image3 = document.getElementById("dice3");
var image4 = document.getElementById("dice4");
var image5 = document.getElementById("dice5");
var image6 = document.getElementById("dice6");
var audio = document.getElementById("audio");
// Gets a random integer, min & max inclusive
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function rollThatDice() {
audio.currentTime = 0;
image.style.animation = "spindice 0.25s";
image2.style.animation = "spindice 0.25s";
image3.style.animation = "spindice 0.25s";
image4.style.animation = "spindice 0.25s";
image5.style.animation = "spindice 0.25s";
image6.style.animation = "spindice 0.25s";
setTimeout(function () {
image.setAttribute("src", diceFaces[getRandomInt(1, 6)]);
image2.setAttribute("src", diceFaces[getRandomInt(7, 12)]);
image3.setAttribute("src", diceFaces[getRandomInt(13, 18)]);
image4.setAttribute("src", diceFaces[getRandomInt(19, 24)]);
image5.setAttribute("src", diceFaces[getRandomInt(25, 30)]);
image6.setAttribute("src", diceFaces[getRandomInt(31, 36)]);
}, 125);
setTimeout(function () {
image.style.animation = "none";
image2.style.animation = "none";
image3.style.animation = "none";
image4.style.animation = "none";
image5.style.animation = "none";
image6.style.animation = "none";
}, 250);
audio.play();
}
document.addEventListener("DOMContentLoaded", function (event) {
rollThatDice();
});

View file

@ -0,0 +1,43 @@
@import url('https://fonts.googleapis.com/css?family=Indie+Flower')
body
width: 100vw
height: 100vh
font-family: 'Indie Flower', sans-serif
background-color: #303030
color: #fff
display: flex
justify-content: center
align-items: center
flex-direction: row
user-select: none
h1
font-size: 25vh
@keyframes spindice
0%
transform: rotate(0deg)
filter: blur(5px)
100%
transform: rotate(360deg)
filter: blur(5px)
img
width: 40vh
padding: 5vh
animation: none
div
font-size: 10vh
color: #fff
background-color: #01944C
height: auto
border: none
padding: 5vh 10vh
border-radius: 50px
cursor: pointer
transition: all 0.5s
&:hover
background-color: #fff
color: #303030

78
Invention-Dice/style.css Normal file
View file

@ -0,0 +1,78 @@
@import url("https://fonts.googleapis.com/css?family=Indie+Flower");
body {
font-family: "Indie Flower", sans-serif;
background-color: #303030;
color: #fff;
display: -webkit-box;
display: flex;
-webkit-box-pack: center;
justify-content: center;
-webkit-box-align: center;
align-items: center;
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
flex-direction: row;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
h1 {
font-size: 45px;
}
@-webkit-keyframes spindice {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
-webkit-filter: blur(5px);
filter: blur(5px);
}
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
-webkit-filter: blur(5px);
filter: blur(5px);
}
}
@keyframes spindice {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
-webkit-filter: blur(5px);
filter: blur(5px);
}
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
-webkit-filter: blur(5px);
filter: blur(5px);
}
}
button {
font-size: 16px;
color: #fff;
background-color: #01944C;
height: auto;
border: none;
padding: 10px 40px;
border-radius: 50px;
cursor: pointer;
-webkit-transition: all 0.5s;
transition: all 0.5s;
}
button:hover {
background-color: #fff;
color: #303030;
}
img {
width: 80px;
padding: 10px;
-webkit-animation: none;
animation: none;
}