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