mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-22 19:18:31 +00:00
cleanup
This commit is contained in:
parent
86c945114d
commit
8e2407cfa9
@ -22,8 +22,6 @@ const sendMessage = (type, payload) => {
|
|||||||
channel.postMessage({ type, payload });
|
channel.postMessage({ type, payload });
|
||||||
};
|
};
|
||||||
|
|
||||||
//phase, num_cycles_at_cps_change, cps, seconds_at_cps_change
|
|
||||||
|
|
||||||
const sendTick = (phase, duration, tick, time) => {
|
const sendTick = (phase, duration, tick, time) => {
|
||||||
const num_seconds_since_cps_change = num_ticks_since_cps_change * duration;
|
const num_seconds_since_cps_change = num_ticks_since_cps_change * duration;
|
||||||
|
|
||||||
@ -40,16 +38,12 @@ const sendTick = (phase, duration, tick, time) => {
|
|||||||
const cycle = begin + secondsSinceLastTick * cps;
|
const cycle = begin + secondsSinceLastTick * cps;
|
||||||
|
|
||||||
sendMessage('tick', {
|
sendMessage('tick', {
|
||||||
phase,
|
|
||||||
time,
|
|
||||||
begin,
|
begin,
|
||||||
end,
|
end,
|
||||||
cps,
|
cps,
|
||||||
tickdeadline,
|
tickdeadline,
|
||||||
num_cycles_at_cps_change,
|
num_cycles_at_cps_change,
|
||||||
num_seconds_at_cps_change,
|
num_seconds_at_cps_change,
|
||||||
duration,
|
|
||||||
num_ticks_since_cps_change,
|
|
||||||
num_seconds_since_cps_change,
|
num_seconds_since_cps_change,
|
||||||
cycle,
|
cycle,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -50,32 +50,27 @@ export class NeoCyclist {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const tickCallback = (payload) => {
|
const tickCallback = (payload) => {
|
||||||
const time = this.getTime();
|
const {
|
||||||
|
|
||||||
let {
|
|
||||||
phase,
|
|
||||||
num_cycles_at_cps_change,
|
num_cycles_at_cps_change,
|
||||||
cps,
|
cps,
|
||||||
num_seconds_at_cps_change,
|
num_seconds_at_cps_change,
|
||||||
duration,
|
|
||||||
num_seconds_since_cps_change,
|
num_seconds_since_cps_change,
|
||||||
begin,
|
begin,
|
||||||
end,
|
end,
|
||||||
tickdeadline,
|
tickdeadline,
|
||||||
|
cycle,
|
||||||
} = payload;
|
} = payload;
|
||||||
this.cps = cps;
|
this.cps = cps;
|
||||||
|
this.cycle = cycle;
|
||||||
|
|
||||||
setTimeReference(num_seconds_at_cps_change, num_seconds_since_cps_change, tickdeadline);
|
setTimeReference(num_seconds_at_cps_change, num_seconds_since_cps_change, tickdeadline);
|
||||||
|
|
||||||
const lastTick = time + tickdeadline;
|
processHaps(begin, end, num_cycles_at_cps_change, num_seconds_at_cps_change);
|
||||||
const secondsSinceLastTick = time - lastTick - duration;
|
|
||||||
this.cycle = begin + secondsSinceLastTick * cps;
|
|
||||||
|
|
||||||
processHaps(begin, end, phase, num_cycles_at_cps_change, num_seconds_at_cps_change);
|
|
||||||
this.time_at_last_tick_message = this.getTime();
|
this.time_at_last_tick_message = this.getTime();
|
||||||
};
|
};
|
||||||
|
|
||||||
const processHaps = (begin, end, phase, num_cycles_at_cps_change, seconds_at_cps_change) => {
|
const processHaps = (begin, end, num_cycles_at_cps_change, seconds_at_cps_change) => {
|
||||||
if (this.started === false) {
|
if (this.started === false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user