From e90622e8a3a3bf0069b74ee8f0d93faf93f1d9ba Mon Sep 17 00:00:00 2001 From: Eugene Serb <46799701+eugene-serb@users.noreply.github.com> Date: Tue, 21 Jun 2022 17:47:39 +0300 Subject: [PATCH] Updated, cleaned --- buypro.html | 14 +++- js/scripts.js | 75 --------------------- json/patterns.json | 159 --------------------------------------------- 3 files changed, 12 insertions(+), 236 deletions(-) delete mode 100644 json/patterns.json diff --git a/buypro.html b/buypro.html index 02af22c..bba3400 100644 --- a/buypro.html +++ b/buypro.html @@ -96,7 +96,7 @@

Buy Pro

-

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 - } - ] - } -] -