From 5874decda281f15ede3e4ebd6a839939aedec4fc Mon Sep 17 00:00:00 2001 From: Eugene Serb <46799701+eugene-serb@users.noreply.github.com> Date: Sat, 18 Jun 2022 20:36:35 +0300 Subject: [PATCH] Added json --- js/scripts.js | 6 ++ json/patterns.json | 159 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 165 insertions(+) create mode 100644 json/patterns.json diff --git a/js/scripts.js b/js/scripts.js index 2a7228f..d872d56 100644 --- a/js/scripts.js +++ b/js/scripts.js @@ -292,6 +292,8 @@ class VibrationMaster { this.patterns = __PATTERNS; this.print(this.patterns); + this.load(); + if (!this.checkGamepadSupport()) { console.log(`This browser does not support of gamepads.`); this.$MESSAGE.innerText = `This browser does not support of gamepads.`; @@ -358,6 +360,10 @@ class VibrationMaster { }; }; + load = () => { + const response = fetch('./json/patterns.json'); + console.log(response); + }; print = (patterns) => { this.$PATTERN_LIST.innerHTML = ''; patterns.forEach((pattern, index) => { diff --git a/json/patterns.json b/json/patterns.json new file mode 100644 index 0000000..f906202 --- /dev/null +++ b/json/patterns.json @@ -0,0 +1,159 @@ +ïŧŋ[ + { + "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 + } + ] + } +] +