mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-06-21 01:48:21 +02:00
Format JS files
This commit is contained in:
@ -6,40 +6,40 @@
|
||||
let cursor = 0
|
||||
const KONAMI_CODE = [38, 38, 40, 40, 37, 39, 37, 39, 66, 65]
|
||||
|
||||
function afterKonami() {
|
||||
// Load Rythm.js
|
||||
var rythmScript = document.createElement('script')
|
||||
rythmScript.setAttribute('src','//unpkg.com/rythm.js@2.2.5/rythm.min.js')
|
||||
document.head.appendChild(rythmScript)
|
||||
function afterKonami () {
|
||||
// Load Rythm.js
|
||||
var rythmScript = document.createElement('script')
|
||||
rythmScript.setAttribute('src', '//unpkg.com/rythm.js@2.2.5/rythm.min.js')
|
||||
document.head.appendChild(rythmScript)
|
||||
|
||||
rythmScript.addEventListener('load', function() {
|
||||
// Ker-Lyon audio courtesy of @adalan, ker-lyon.fr
|
||||
const audioElement = new Audio('/static/song/konami.ogg')
|
||||
audioElement.loop = true
|
||||
audioElement.play()
|
||||
rythmScript.addEventListener('load', function () {
|
||||
// Ker-Lyon audio courtesy of @adalan, ker-lyon.fr
|
||||
const audioElement = new Audio('/static/song/konami.ogg')
|
||||
audioElement.loop = true
|
||||
audioElement.play()
|
||||
|
||||
const rythm = new Rythm()
|
||||
rythm.connectExternalAudioElement(audioElement)
|
||||
rythm.addRythm('card', 'pulse', 50, 50, {
|
||||
min: 1,
|
||||
max: 1.1
|
||||
})
|
||||
rythm.addRythm('d-flex', 'color', 50, 50, {
|
||||
from: [64,64,64],
|
||||
to:[128,64,128]
|
||||
})
|
||||
rythm.addRythm('nav-link', 'jump', 150, 50, {
|
||||
min: 0,
|
||||
max: 10
|
||||
})
|
||||
rythm.start()
|
||||
});
|
||||
const rythm = new Rythm()
|
||||
rythm.connectExternalAudioElement(audioElement)
|
||||
rythm.addRythm('card', 'pulse', 50, 50, {
|
||||
min: 1,
|
||||
max: 1.1
|
||||
})
|
||||
rythm.addRythm('d-flex', 'color', 50, 50, {
|
||||
from: [64, 64, 64],
|
||||
to: [128, 64, 128]
|
||||
})
|
||||
rythm.addRythm('nav-link', 'jump', 150, 50, {
|
||||
min: 0,
|
||||
max: 10
|
||||
})
|
||||
rythm.start()
|
||||
})
|
||||
}
|
||||
|
||||
// Register custom event
|
||||
document.addEventListener('keydown', (e) => {
|
||||
cursor = (e.keyCode == KONAMI_CODE[cursor]) ? cursor + 1 : 0;
|
||||
if (cursor == KONAMI_CODE.length) {
|
||||
afterKonami()
|
||||
}
|
||||
});
|
||||
cursor = (e.keyCode == KONAMI_CODE[cursor]) ? cursor + 1 : 0
|
||||
if (cursor == KONAMI_CODE.length) {
|
||||
afterKonami()
|
||||
}
|
||||
})
|
||||
|
Reference in New Issue
Block a user