styling, use setInterval
This commit is contained in:
parent
c6aab77f3e
commit
09ae676e34
69
src/App.vue
69
src/App.vue
@ -40,8 +40,6 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
|
||||||
const getAudioContext = () => {
|
const getAudioContext = () => {
|
||||||
let ctx = null, usingWebAudio = true;
|
let ctx = null, usingWebAudio = true;
|
||||||
|
|
||||||
@ -142,10 +140,14 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
const randomColor = "#"+((1<<24)*Math.random()|0).toString(16);
|
||||||
|
document.documentElement.style.setProperty('--main-bg-color', randomColor);
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
playOSC: function (freq = 440.0, type = 'sine') {
|
playOSC: function (freq = 440.0, type = 'triangle') {
|
||||||
if (this.oscMain != null) {
|
if (this.oscMain != null) {
|
||||||
console.log("stopping")
|
|
||||||
this.oscMain.stop();
|
this.oscMain.stop();
|
||||||
this.oscMain = null;
|
this.oscMain = null;
|
||||||
}
|
}
|
||||||
@ -185,21 +187,15 @@ export default {
|
|||||||
this.score += 1
|
this.score += 1
|
||||||
this.check = []
|
this.check = []
|
||||||
this.success = true
|
this.success = true
|
||||||
|
this.blink = null
|
||||||
setTimeout(()=>{
|
|
||||||
|
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
this.success = false
|
this.success = false
|
||||||
this.fail = false
|
this.fail = false
|
||||||
},200)
|
|
||||||
|
|
||||||
this.blink = null
|
|
||||||
this.check = []
|
|
||||||
this.addToPattern()
|
this.addToPattern()
|
||||||
this.playPattern()
|
this.playPattern()
|
||||||
},200)
|
},200)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -209,7 +205,7 @@ export default {
|
|||||||
this.audioContext = getAudioContext()
|
this.audioContext = getAudioContext()
|
||||||
}
|
}
|
||||||
|
|
||||||
this.playOSC(this.spaces[0].tone)
|
//this.playOSC(this.spaces[0].tone)
|
||||||
|
|
||||||
this.reset()
|
this.reset()
|
||||||
},
|
},
|
||||||
@ -225,22 +221,28 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
playPattern() {
|
playPattern() {
|
||||||
|
var i = 0
|
||||||
this.playing = true
|
this.playing = true
|
||||||
for(let i = 0; i < this.pattern.length; i++ ) {
|
|
||||||
setTimeout(()=> {
|
var moves = setInterval(() => {
|
||||||
setTimeout(()=> {
|
|
||||||
this.blink = this.pattern[i]
|
this.blink = this.pattern[i]
|
||||||
this.playOSC(this.spaces[this.pattern[i]].tone)
|
this.playOSC(this.spaces[this.pattern[i]].tone)
|
||||||
}, 900)
|
i++
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
this.blink = null
|
||||||
|
}, 500)
|
||||||
|
|
||||||
|
if(i >= this.pattern.length) {
|
||||||
|
clearInterval(moves)
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.blink = null
|
this.blink = null
|
||||||
if(i == this.pattern.length - 1) {
|
|
||||||
this.playing = false
|
this.playing = false
|
||||||
|
}, 200)
|
||||||
}
|
}
|
||||||
}, 1000)
|
},600)
|
||||||
}, 600 * (i+1))
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
addToPattern() {
|
addToPattern() {
|
||||||
@ -263,7 +265,7 @@ html, body{
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
background: black;
|
background: var(--main-bg-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -294,10 +296,8 @@ body {
|
|||||||
max-width: 640px;
|
max-width: 640px;
|
||||||
height: 100vw;
|
height: 100vw;
|
||||||
max-height: 640px;
|
max-height: 640px;
|
||||||
border: 3px dotted black;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.simeon-game-board {
|
.simeon-game-board {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 50% 50%;
|
grid-template-columns: 50% 50%;
|
||||||
@ -347,24 +347,23 @@ body {
|
|||||||
display: grid;
|
display: grid;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
box-shadow: 1px -1px 11px -1px black, inset -12px -9px 20px 2px #000000a6;
|
box-shadow: 1px -1px 11px -1px black, inset -9px 0px 20px 2px #000000ab, inset 8px 0px 20px 2px #ffffffa6;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.piece-t-l {
|
.piece-t-l {
|
||||||
background: #12cb56;
|
background-color: #12cb56;
|
||||||
border-top-left-radius: 100%;
|
border-top-left-radius: 100%;
|
||||||
}
|
}
|
||||||
.piece-t-r {
|
.piece-t-r {
|
||||||
background: #fd0010;
|
background-color: #fd0010;
|
||||||
border-top-right-radius: 100%;
|
border-top-right-radius: 100%;
|
||||||
}
|
}
|
||||||
.piece-b-l {
|
.piece-b-l {
|
||||||
background: #f1c200;
|
background-color: #f1c200;
|
||||||
border-bottom-left-radius: 100%;
|
border-bottom-left-radius: 100%;
|
||||||
}
|
}
|
||||||
.piece-b-r {
|
.piece-b-r {
|
||||||
background: #1264ca;
|
background-color: #1264ca;
|
||||||
border-bottom-right-radius: 100%;
|
border-bottom-right-radius: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -372,7 +371,7 @@ body {
|
|||||||
font-size: 25px;
|
font-size: 25px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
line-height: 50px;
|
line-height: 50px;
|
||||||
color: white;
|
color: #ffffffa8;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
border-radius: 100%;
|
border-radius: 100%;
|
||||||
height: 50px;;
|
height: 50px;;
|
||||||
@ -399,7 +398,7 @@ body {
|
|||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background: linear-gradient(45deg, black, transparent);
|
background: linear-gradient(45deg, #262626, #ffffff29);
|
||||||
text-shadow: -1px -1px 0px #838383;
|
text-shadow: -1px -1px 0px #838383;
|
||||||
color: black;
|
color: black;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -411,7 +410,7 @@ body {
|
|||||||
border-bottom: 1px solid #262626;
|
border-bottom: 1px solid #262626;
|
||||||
}
|
}
|
||||||
|
|
||||||
.start button:disabled {
|
.start button:disabled, .reset button:disabled {
|
||||||
color: #838383;
|
color: #838383;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
text-shadow: -1px -1px 0px black;
|
text-shadow: -1px -1px 0px black;
|
||||||
@ -435,6 +434,12 @@ body {
|
|||||||
.key {
|
.key {
|
||||||
text-shadow: 0 0 5px black;
|
text-shadow: 0 0 5px black;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-height:640px) {
|
||||||
|
.simeon-wrapper {
|
||||||
|
max-height: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
@media (max-width:640px) {
|
@media (max-width:640px) {
|
||||||
.simeon-wrapper {
|
.simeon-wrapper {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user