-
Pre order of the PRO version just for $5.
+
Pre order of the PRO version just for $5. Dates of the Release will be announced later.
Write me:
eugene.serb@gmail.com
@@ -117,7 +117,7 @@
+ |
- Gamepad buttons |
+ Control with a Gamepad |
- |
+ |
@@ -126,6 +126,16 @@
- |
+ |
+
+ Additional patterns |
+ - |
+ + |
+
+
+ Full control over gamepads |
+ - |
+ + |
+
diff --git a/js/scripts.js b/js/scripts.js
index eb08ad8..b85e858 100644
--- a/js/scripts.js
+++ b/js/scripts.js
@@ -188,13 +188,10 @@ class Gamepad {
init = () => {
this.id = Date.now();
this.canVibrate = (this.unit.vibrationActuator) ? true : false;
- this.isSelected = false;
this.isVibrating = false;
- this.isLocked = false;
this.library = new Library;
- this.cooldown = 0;
this.index = 0;
this.pattern = this.library.patterns[this.index].pattern;
@@ -255,35 +252,6 @@ class Gamepad {
sleep = (ms) => {
return new Promise(resolve => setTimeout(resolve, ms));
};
- previous = () => {
- if (Date.now() >= this.cooldown) {
- if (this.index === 0) {
- this.index = this.library.patterns.length - 1;
- } else {
- this.index--;
- };
- this.pattern = this.library.patterns[this.index].pattern;
- this.cooldown = Date.now() + 500;
- };
- };
- next = () => {
- if (Date.now() >= this.cooldown) {
- if (this.index === this.library.patterns.length - 1) {
- this.index = 0;
- } else {
- this.index++;
- };
- this.pattern = this.library.patterns[this.index].pattern;
- this.cooldown = Date.now() + 500;
- };
- };
- lock = () => {
- if (Date.now() >= this.cooldown) {
- this.isLocked = !this.isLocked;
- this.cooldown = Date.now() + 500;
- };
- };
-
change = (index) => {
this.index = index;
this.pattern = this.library.patterns[this.index].pattern;
@@ -337,50 +305,7 @@ class Wavelovers {
});
};
};
- eventHandler = () => {
- if (this.gamepads.length > 0) {
- this.gamepads.forEach(gamepad => {
- if (gamepad.canVibrate === true) {
- if (gamepad.unit.buttons[2].pressed === true &&
- gamepad.unit.buttons[3].pressed === true) {
- gamepad.lock();
- };
- if (gamepad.isLocked === false) {
- if (gamepad.unit.buttons[0].pressed === true) {
- if (gamepad.isVibrating === false) {
- gamepad.vibrate();
- };
- };
- if (gamepad.unit.buttons[1].pressed === true) {
- gamepad.reset();
- };
- if (gamepad.unit.buttons[4].pressed === true) {
- gamepad.previous();
- };
- if (gamepad.unit.buttons[5].pressed === true) {
- gamepad.next();
- };
- };
- };
- });
- };
- };
- load = async () => {
- const url = 'https://eugene-serb.github.io/wavelovers/json/patterns.json';
- try {
- const response = await fetch(url);
- if (response.ok) {
- let json = await response.json();
- this.library.patterns = json;
- this.print(this.library.patterns);
- } else {
- console.log('Connect to the Internet for download more patterns...');
- };
- } catch (error) {
- console.log('[error]', error);
- };
- };
print = (patterns) => {
this.$PATTERN_LIST.innerHTML = '';
patterns.forEach((pattern, index) => {
diff --git a/json/patterns.json b/json/patterns.json
deleted file mode 100644
index f906202..0000000
--- a/json/patterns.json
+++ /dev/null
@@ -1,159 +0,0 @@
-ïŧŋ[
- {
- "name": "Dotted Weak",
- "type": "Simple",
- "icon": "ð",
- "pattern": [
- {
- "startDelay": 100,
- "duration": 100,
- "weakMagnitude": 1.0,
- "strongMagnitude": 0.0
- }
- ]
- },
- {
- "name": "Dotted Strong",
- "type": "Simple",
- "icon": "ð",
- "pattern": [
- {
- "startDelay": 100,
- "duration": 100,
- "weakMagnitude": 0.0,
- "strongMagnitude": 1.0
- }
- ]
- },
- {
- "name": "Dotted Max",
- "type": "Simple",
- "icon": "ð",
- "pattern": [
- {
- "startDelay": 100,
- "duration": 100,
- "weakMagnitude": 1.0,
- "strongMagnitude": 1.0
- }
- ]
- },
- {
- "name": "Short Dashed Weak",
- "type": "Simple",
- "icon": "ð",
- "pattern": [
- {
- "startDelay": 100,
- "duration": 250,
- "weakMagnitude": 1.0,
- "strongMagnitude": 0.0
- }
- ]
- },
- {
- "name": "Short Dashed Strong",
- "type": "Simple",
- "icon": "ð",
- "pattern": [
- {
- "startDelay": 100,
- "duration": 250,
- "weakMagnitude": 0.0,
- "strongMagnitude": 1.0
- }
- ]
- },
- {
- "name": "Short Dashed Max",
- "type": "Simple",
- "icon": "ð",
- "pattern": [
- {
- "startDelay": 100,
- "duration": 250,
- "weakMagnitude": 1.0,
- "strongMagnitude": 1.0
- }
- ]
- },
- {
- "name": "Long Dashed Weak",
- "type": "Simple",
- "icon": "ð",
- "pattern": [
- {
- "startDelay": 100,
- "duration": 500,
- "weakMagnitude": 1.0,
- "strongMagnitude": 0.0
- }
- ]
- },
- {
- "name": "Long Dashed Strong",
- "type": "Simple",
- "icon": "ð",
- "pattern": [
- {
- "startDelay": 100,
- "duration": 500,
- "weakMagnitude": 0.0,
- "strongMagnitude": 1.0
- }
- ]
- },
- {
- "name": "Long Dashed Max",
- "type": "Simple",
- "icon": "ðĪŠ",
- "pattern": [
- {
- "startDelay": 100,
- "duration": 500,
- "weakMagnitude": 1.0,
- "strongMagnitude": 1.0
- }
- ]
- },
- {
- "name": "Constant Weak",
- "type": "Simple",
- "icon": "ð",
- "pattern": [
- {
- "startDelay": 0,
- "duration": 1000,
- "weakMagnitude": 1.0,
- "strongMagnitude": 0.0
- }
- ]
- },
- {
- "name": "Constant Strong",
- "type": "Simple",
- "icon": "ðĪĐ",
- "pattern": [
- {
- "startDelay": 0,
- "duration": 1000,
- "weakMagnitude": 0.0,
- "strongMagnitude": 1.0
- }
- ]
- },
- {
- "name": "Constant Max",
- "type": "Simple",
- "icon": "ð",
- "pattern": [
- {
- "startDelay": 0,
- "duration": 1000,
- "weakMagnitude": 1.0,
- "strongMagnitude": 1.0
- }
- ]
- }
-]
-