Added json

This commit is contained in:
Eugene Serb 2022-06-18 20:36:35 +03:00
parent b1237d5bfd
commit 5874decda2
2 changed files with 165 additions and 0 deletions

View File

@ -292,6 +292,8 @@ class VibrationMaster {
this.patterns = __PATTERNS; this.patterns = __PATTERNS;
this.print(this.patterns); this.print(this.patterns);
this.load();
if (!this.checkGamepadSupport()) { if (!this.checkGamepadSupport()) {
console.log(`This browser does not support of gamepads.`); console.log(`This browser does not support of gamepads.`);
this.$MESSAGE.innerText = `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) => { print = (patterns) => {
this.$PATTERN_LIST.innerHTML = ''; this.$PATTERN_LIST.innerHTML = '';
patterns.forEach((pattern, index) => { patterns.forEach((pattern, index) => {

159
json/patterns.json Normal file
View File

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