mirror of
https://github.com/eugene-serb/wavelovers.git
synced 2023-09-09 23:41:16 +03:00
- optimize IVibrator and Vibrator by delete unused this.patterns and add const offsetTime in vibrate.
- added in all models readonly token. - rebuild and deploy
This commit is contained in:
parent
81ab823b6a
commit
dd856936cc
@ -15,4 +15,4 @@
|
|||||||
webvisor: true
|
webvisor: true
|
||||||
});</script><style>[v-cloak] {
|
});</script><style>[v-cloak] {
|
||||||
display: none;
|
display: none;
|
||||||
}</style><script defer="defer" src="/js/chunk-vendors.248cd14b.js"></script><script defer="defer" src="/js/app.9e6bfa01.js"></script><link href="/css/app.b1ea1061.css" rel="stylesheet"></head><body><header class="header"><div class="header-wrapper container"><div class="logo-wrapper"><span class="logo-wrapper__logo" translate="no">Wavelovers</span></div><nav class="menu-wrapper"><ul class="navigation"><li class="navigation__item"><a href="/" target="_self" class="navigation__link">Home</a></li><li class="navigation__item"><a href="/faq.html" target="_self" class="navigation__link">FAQ</a></li><li class="navigation__item"><a href="/about.html" target="_self" class="navigation__link">About</a></li><li class="navigation__item"><a href="/donate.html" target="_self" class="navigation__link">Donate</a></li></ul></nav></div></header><main class="page container"><h1 class="visually-hidden">Wavelovers</h1><div id="app" v-cloak></div></main><footer class="footer"><div class="footer-wrapper container"><div class="annotation"><span class="annotation__text">© 2022 Wavelovers. Content licensed under </span><a href="https://wavelovers.ru/LICENSE.md" target="_blank">GNU General Public License v3.0</a><br><span class="annotation__text">This site is open source. </span><a href="https://github.com/eugene-serb/wavelovers/" target="_blank">Improve this page.</a></div><div class="annotation created-by"><span class="annotation__text">Created by</span><a href="https://eugene-serb.github.io/" target="_blank" translate="no">Eugene Serb</a></div></div></footer><noscript>You need to enable JavaScript to run this app.</noscript><noscript><div><img src="https://mc.yandex.ru/watch/89252711" style="position:absolute; left:-9999px;" alt=""/></div></noscript></body></html>
|
}</style><script defer="defer" src="/js/chunk-vendors.248cd14b.js"></script><script defer="defer" src="/js/app.26b99067.js"></script><link href="/css/app.b1ea1061.css" rel="stylesheet"></head><body><header class="header"><div class="header-wrapper container"><div class="logo-wrapper"><span class="logo-wrapper__logo" translate="no">Wavelovers</span></div><nav class="menu-wrapper"><ul class="navigation"><li class="navigation__item"><a href="/" target="_self" class="navigation__link">Home</a></li><li class="navigation__item"><a href="/faq.html" target="_self" class="navigation__link">FAQ</a></li><li class="navigation__item"><a href="/about.html" target="_self" class="navigation__link">About</a></li><li class="navigation__item"><a href="/donate.html" target="_self" class="navigation__link">Donate</a></li></ul></nav></div></header><main class="page container"><h1 class="visually-hidden">Wavelovers</h1><div id="app" v-cloak></div></main><footer class="footer"><div class="footer-wrapper container"><div class="annotation"><span class="annotation__text">© 2022 Wavelovers. Content licensed under </span><a href="https://wavelovers.ru/LICENSE.md" target="_blank">GNU General Public License v3.0</a><br><span class="annotation__text">This site is open source. </span><a href="https://github.com/eugene-serb/wavelovers/" target="_blank">Improve this page.</a></div><div class="annotation created-by"><span class="annotation__text">Created by</span><a href="https://eugene-serb.github.io/" target="_blank" translate="no">Eugene Serb</a></div></div></footer><noscript>You need to enable JavaScript to run this app.</noscript><noscript><div><img src="https://mc.yandex.ru/watch/89252711" style="position:absolute; left:-9999px;" alt=""/></div></noscript></body></html>
|
2
docs/js/app.26b99067.js
Normal file
2
docs/js/app.26b99067.js
Normal file
File diff suppressed because one or more lines are too long
1
docs/js/app.26b99067.js.map
Normal file
1
docs/js/app.26b99067.js.map
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -2,13 +2,13 @@ import IVibrationActuator from '@/models/IVibrationActuator';
|
|||||||
import IGamepadButton from '@/models/IGamepadButton';
|
import IGamepadButton from '@/models/IGamepadButton';
|
||||||
|
|
||||||
interface IGamepad {
|
interface IGamepad {
|
||||||
id: string;
|
readonly id: string;
|
||||||
index: number;
|
readonly index: number;
|
||||||
timestamp: number;
|
readonly timestamp: number;
|
||||||
connected: boolean;
|
readonly connected: boolean;
|
||||||
mapping: string;
|
readonly mapping: string;
|
||||||
axes: number[];
|
readonly axes: number[];
|
||||||
buttons: IGamepadButton[];
|
readonly buttons: IGamepadButton[];
|
||||||
vibrationActuator: IVibrationActuator;
|
vibrationActuator: IVibrationActuator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
interface IGamepadButton {
|
interface IGamepadButton {
|
||||||
pressed: boolean;
|
readonly pressed: boolean;
|
||||||
touched: boolean;
|
readonly touched: boolean;
|
||||||
value: number;
|
readonly value: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default IGamepadButton;
|
export default IGamepadButton;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import IGamepad from '@/models/IGamepad';
|
import IGamepad from '@/models/IGamepad';
|
||||||
|
|
||||||
interface IGamepadEvent {
|
interface IGamepadEvent {
|
||||||
gamepad: IGamepad;
|
readonly gamepad: IGamepad;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default IGamepadEvent;
|
export default IGamepadEvent;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import TPatternUnit from '@/models/TPatternUnit';
|
import TPatternUnit from '@/models/TPatternUnit';
|
||||||
|
|
||||||
interface IVibrationActuator {
|
interface IVibrationActuator {
|
||||||
type: string;
|
readonly type: string;
|
||||||
reset(): void;
|
reset(): void;
|
||||||
playEffect(mode: string, pattern: TPatternUnit): void;
|
playEffect(mode: string, pattern: TPatternUnit): void;
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ interface IVibrator {
|
|||||||
readonly canVibrate: boolean;
|
readonly canVibrate: boolean;
|
||||||
isVibrating: boolean;
|
isVibrating: boolean;
|
||||||
unit: IGamepad;
|
unit: IGamepad;
|
||||||
pattern: TPatternUnit[];
|
|
||||||
interval: number;
|
interval: number;
|
||||||
update(): void;
|
update(): void;
|
||||||
reset(): void;
|
reset(): void;
|
||||||
|
@ -7,7 +7,6 @@ class Vibrator implements IVibrator {
|
|||||||
readonly canVibrate: boolean;
|
readonly canVibrate: boolean;
|
||||||
isVibrating: boolean;
|
isVibrating: boolean;
|
||||||
unit: IGamepad;
|
unit: IGamepad;
|
||||||
pattern: TPatternUnit[];
|
|
||||||
interval: number;
|
interval: number;
|
||||||
|
|
||||||
constructor(unit: IGamepad) {
|
constructor(unit: IGamepad) {
|
||||||
@ -15,8 +14,6 @@ class Vibrator implements IVibrator {
|
|||||||
this.id = Date.now();
|
this.id = Date.now();
|
||||||
this.canVibrate = (this.unit.vibrationActuator) ? true : false;
|
this.canVibrate = (this.unit.vibrationActuator) ? true : false;
|
||||||
this.isVibrating = false;
|
this.isVibrating = false;
|
||||||
this.pattern = [];
|
|
||||||
|
|
||||||
this.update = this.update.bind(this);
|
this.update = this.update.bind(this);
|
||||||
this.interval = setInterval(this.update, 1);
|
this.interval = setInterval(this.update, 1);
|
||||||
}
|
}
|
||||||
@ -33,12 +30,12 @@ class Vibrator implements IVibrator {
|
|||||||
|
|
||||||
async vibrate(pattern: TPatternUnit[]) {
|
async vibrate(pattern: TPatternUnit[]) {
|
||||||
this.isVibrating = true;
|
this.isVibrating = true;
|
||||||
this.pattern = pattern;
|
const offsetTime = 10;
|
||||||
while (this.isVibrating === true) {
|
while (this.isVibrating === true) {
|
||||||
for (let i = 0; i < this.pattern.length; i++) {
|
for (let i = 0; i < pattern.length; i++) {
|
||||||
if (this.isVibrating === true) {
|
if (this.isVibrating === true) {
|
||||||
this.unit.vibrationActuator.playEffect('dual-rumble', this.pattern[i]);
|
this.unit.vibrationActuator.playEffect('dual-rumble', pattern[i]);
|
||||||
await this.sleep(this.pattern[i].startDelay + this.pattern[i].duration - 10);
|
await this.sleep(pattern[i].startDelay + pattern[i].duration - offsetTime);
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user