diff --git a/app/components/Box.vue b/app/components/Box.vue
index 67c8806..033160d 100644
--- a/app/components/Box.vue
+++ b/app/components/Box.vue
@@ -5,6 +5,7 @@
@@ -142,13 +143,6 @@ function rotateBox() {
applyTransform(0.8)
}
-watch(
- () => props.box.activeSide,
- () => {
- rotateBox()
- }
-)
-
// --- Inertie ---
function tickInertia() {
if (!enableInertia) return
@@ -246,6 +240,10 @@ onBeforeUnmount(() => {
})
// --- Watchers ---
+watch(
+ () => props.box.activeSide,
+ () => rotateBox()
+)
watch(
() => props.box.state,
() => applyBoxState()
@@ -255,7 +253,10 @@ watch(
() => applyColor(),
{ deep: true }
)
-watch(isDraggable, (enabled) => (enabled ? addListeners() : removeListeners()))
+watch(
+ isDraggable,
+ (enabled) => (enabled ? addListeners() : removeListeners())
+)
diff --git a/app/layouts/default.vue b/app/layouts/default.vue
index 6e5a156..1c1a9d1 100644
--- a/app/layouts/default.vue
+++ b/app/layouts/default.vue
@@ -3,7 +3,6 @@
-
-
+
diff --git a/app/platine-tools/controls.ts b/app/platine-tools/controls.ts
new file mode 100644
index 0000000..74d4277
--- /dev/null
+++ b/app/platine-tools/controls.ts
@@ -0,0 +1,48 @@
+class Controls {
+ public toggleButton: HTMLButtonElement;
+ public rewindButton: HTMLButtonElement;
+
+ public isPlaying: boolean = false;
+
+ public callbacks = {
+ // @ts-expect-error: unused var
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ onIsplayingChanged: (isPlaying: boolean) => {},
+ onRewind: () => {},
+ };
+
+ constructor({
+ toggleButton,
+ rewindButton,
+ }: {
+ toggleButton: HTMLButtonElement;
+ rewindButton: HTMLButtonElement;
+ }) {
+ this.toggleButton = toggleButton;
+ this.rewindButton = rewindButton;
+
+ this.toggleButton.addEventListener('click', () => this.toggle());
+ this.rewindButton.addEventListener('click', () => this.rewind());
+
+ this.isDisabled = true;
+ }
+
+ set isDisabled(disabled: boolean) {
+ this.toggleButton.disabled = disabled;
+ this.rewindButton.disabled = disabled;
+ }
+
+ toggle() {
+ this.isPlaying = !this.isPlaying;
+
+ this.toggleButton.classList.toggle('is-active', this.isPlaying);
+
+ this.callbacks.onIsplayingChanged(this.isPlaying);
+ }
+
+ rewind() {
+ this.callbacks.onRewind();
+ }
+}
+
+export default Controls;
diff --git a/app/platine-tools/disc.ts b/app/platine-tools/disc.ts
new file mode 100644
index 0000000..34c627c
--- /dev/null
+++ b/app/platine-tools/disc.ts
@@ -0,0 +1,379 @@
+const TAU = Math.PI * 2
+
+const targetFPS = 60
+const RPS = 0.75
+const RPM = RPS * 60
+
+const RADIANS_PER_MINUTE = RPM * TAU
+const RADIANS_PER_SECOND = RADIANS_PER_MINUTE / 60
+const RADIANS_PER_MILLISECOND = RADIANS_PER_SECOND * 0.001
+
+const ROTATION_SPEED = (TAU * RPS) / targetFPS
+
+type Vector = {
+ x: number
+ y: number
+}
+
+type NumberArray = Array