Definitively more usable

This commit is contained in:
Alexandre Iooss 2020-09-03 11:47:17 +02:00
parent cc7ebd2d8a
commit 76aacaf048
2 changed files with 16 additions and 9 deletions

View File

@ -9,21 +9,28 @@ const KONAMI_CODE = [38, 38, 40, 40, 37, 39, 37, 39, 66, 65]
function afterKonami() { function afterKonami() {
// Load Rythm.js // Load Rythm.js
var rythmScript = document.createElement('script') var rythmScript = document.createElement('script')
rythmScript.setAttribute('src','https://unpkg.com/rythm.js@2.2.5/rythm.min.js') rythmScript.setAttribute('src','//unpkg.com/rythm.js@2.2.5/rythm.min.js')
document.head.appendChild(rythmScript) document.head.appendChild(rythmScript)
rythmScript.addEventListener('load', function() { rythmScript.addEventListener('load', function() {
// This media source need to be accessible with a cross-origin header // Ker-Lyon audio courtesy of @adalan, ker-lyon.fr
const audioElement = new Audio('https://okazari.github.io/Rythm.js/samples/rythmC.mp3') const audioElement = new Audio('/static/song/konami.ogg')
audioElement.crossOrigin = 'anonymous' audioElement.loop = true
audioElement.play(); audioElement.play()
const rythm = new Rythm() const rythm = new Rythm()
rythm.connectExternalAudioElement(audioElement) rythm.connectExternalAudioElement(audioElement)
rythm.addRythm('card', 'pulse', 0, 10) rythm.addRythm('card', 'pulse', 50, 50, {
rythm.addRythm('nav-link', 'color', 0, 10, { min: 1,
from: [0,0,255], max: 1.1
to:[255,0,255] })
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() rythm.start()
}); });

Binary file not shown.