Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7d7e3b9

Browse files
committed
Added support for custom users functions (Okazari#25)
1 parent b1effbd commit 7d7e3b9

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/Dancer.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ class Dancer {
2222
}
2323

2424
dance(type, className, ratio, options) {
25-
const dance = this.dances[type] || this.dances['size']
25+
let dance = type
26+
if( typeof type === 'string' ) {
27+
dance = this.dances[type] || this.dances['pulse']
28+
}
2629
const elements = document.getElementsByClassName(className)
2730
Array.from(elements).forEach(elem => dance(elem, ratio, options))
2831
}

src/rythm.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ export default class Rythm {
1010
this.maxValueHistory = analyser.maxValueHistory
1111
this.dancer = dancer
1212
this.rythms = []
13-
this.addRythm('rythm-bass','pulse',0,10)
14-
this.addRythm('rythm-medium','pulse',150,40)
15-
this.addRythm('rythm-high','pulse',400,200)
13+
this.addRythm('rythm-bass', 'pulse', 0, 10)
14+
this.addRythm('rythm-medium', 'pulse', 150, 40)
15+
this.addRythm('rythm-high', 'pulse', 400, 200)
1616
}
1717

1818
connectExternalAudioElement = (audioElement) => this.player.connectExternalAudioElement (audioelement)

0 commit comments

Comments
 (0)