瀏覽代碼

fixed clock

unknown 3 年之前
父節點
當前提交
de47abee4e
共有 3 個文件被更改,包括 6 次插入5 次删除
  1. 1 1
      .eslintcache
  2. 2 2
      src/App.tsx
  3. 3 2
      src/components/TimerContainer/TimerPresentation/TimerPresentation.tsx

File diff suppressed because it is too large
+ 1 - 1
.eslintcache


+ 2 - 2
src/App.tsx

@@ -16,8 +16,8 @@ function App() {
       <RangeInput min={2} max={10} />
       <PasswordConfirm min={5} />
       <TimerContainer
-        amountMs={180000}
-        refresh={1000}
+        amountMs={4528000}
+        refresh={10}
         render={TimerPresentation}
       />
       <ToastContainer

+ 3 - 2
src/components/TimerContainer/TimerPresentation/TimerPresentation.tsx

@@ -21,9 +21,10 @@ const TimerPresentation = ({ seconds, refresh }: ITimerPresentationProps) => {
       '[data-second-hand]',
     ) as HTMLDivElement;
     function setClock() {
+      console.log(seconds, seconds / 60, seconds / 60 / 60);
       const secondsRatio = seconds / 60;
-      const minutesRatio = (secondsRatio + secondsRatio) / 60;
-      const hoursRatio = (minutesRatio + secondsRatio / 12) / 12;
+      const minutesRatio = seconds / 60 / 60;
+      const hoursRatio = seconds / 60 / 60 / 12;
       setRotation(secondHand, secondsRatio);
       setRotation(minuteHand, minutesRatio);
       setRotation(hourHand, hoursRatio);