A list of patterns can be exported in JSON
format or a .js
file containing functions for\nhandling exported patterns.
The JSON
format is destined to be handled by the developers for custom implementation of vibration\nfunctions or custom devices. The file contains a list of patterns (key is the pattern's title or id specified when it\nwas exported). Each pattern is an array
where each element is an entity described by two parameters:\nintensity
- relative intensity of vibration, and duration
- time (in milliseconds) of the\nvibration. Next is presented an example of the content of a JSON
file:
\n{\n \"First pattern\": [\n {\"intensity\": 50, \"duration\": 100}, {\"intensity\": 56, \"duration\": 100}, , {\"intensity\": 62, \"duration\": 100},\n {\"intensity\": 68, \"duration\": 100}, {\"intensity\": 74, \"duration\": 100}, {\"intensity\": 80, \"duration\": 100},\n {\"intensity\": 86, \"duration\": 100}, {\"intensity\": 92, \"duration\": 100}, {\"intensity\": 98, \"duration\": 100}\n ],\n \"second_pattern_key\": [\n {\"intensity\": 80, \"duration\": 250}, {\"intensity\": 40, \"duration\": 250}, , {\"intensity\": 80, \"duration\": 250},\n {\"intensity\": 40, \"duration\": 250}, {\"intensity\": 80, \"duration\": 250}, {\"intensity\": 40, \"duration\": 250},\n {\"intensity\": 80, \"duration\": 250}, {\"intensity\": 40, \"duration\": 250}, {\"intensity\": 88, \"duration\": 250}\n ]\n}\n
\n
\n\nJS
file exports a function that can be used to handle exported patterns. This function has three main\napplications:\n
\n(in bellow examples, it is supposed that the developer exported patterns in\npatterns.js
file)\n\n
\nimport vireo from './patterns';\n\nconst firstPattern = vireo(\"First pattern\");\nconst secondPattern = vireo(\"second_pattern_key\");\n\nif (firstAction()) {\n vibrotactileFeedback(firstPattern);\n} else {\n vibrotactileFeedback(secondPattern);\n}\n
\n
\n\npwm
:\nimport vireo from './patterns';\n\nconst firstPattern = vireo.navigatorParam(\"First pattern\");\nconst secondPattern = vireo.navigatorParam(\"second_pattern_key\");\n\nif (firstAction()) {\n navigator.vibrate(firstPattern);\n} else {\n navigator.vibrate(secondPattern);\n}\n
\n
\n\nnavigator
to perform the vibration:\nimport vireo from './patterns';\n\nif (firstAction()) {\n vireo.vibrate(\"First pattern\");\n} else {\n vireo.vibrate(\"second_pattern_key\");\n}\n
\n
\n\nA(t) = Amaxe-Ï„t + D + c\n
A(t) = at + b\n
A(t) = at2 + bt + c\n
A(t) = Amaxe-τt sin(2πωt) + c\n
A(t) = Amaxln(at) + c\n
A(t) = Amaxlogb(at) + c\n
Free draw\n
\n {{ this.valPatterns }}\n