From 7501b369212bd74ff70c6cdfb43d2af6c0ba3a97 Mon Sep 17 00:00:00 2001 From: LeeSeungmin Date: Fri, 29 Mar 2024 20:21:20 +0900 Subject: [PATCH] =?UTF-8?q?[#25]Enhance:=20=EC=8B=A4=20=EB=94=94=EB=B0=94?= =?UTF-8?q?=EC=9D=B4=EC=8A=A4=EC=97=90=EC=84=9C=20=EC=95=A0=EB=8B=88?= =?UTF-8?q?=EB=A9=94=EC=9D=B4=EC=85=98=20=EC=A0=9C=EB=8C=80=EB=A1=9C=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9=20=EC=95=88=20=EB=90=98=EB=8A=94=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - progess를 셋째자리까지 표현하면 오차가 발생해서 원하는대로 애니메이션이 적용되지 않음. - 또한 각도를 30도로 하게 되면 점과 선의 거리가 멀어 보여서 18도로 설정 --- .../Subviews/Cell/FallingUserCollectionViewCell.swift | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Projects/Features/Falling/Src/Subviews/Cell/FallingUserCollectionViewCell.swift b/Projects/Features/Falling/Src/Subviews/Cell/FallingUserCollectionViewCell.swift index b6e0cc24..165a8284 100644 --- a/Projects/Features/Falling/Src/Subviews/Cell/FallingUserCollectionViewCell.swift +++ b/Projects/Features/Falling/Src/Subviews/Cell/FallingUserCollectionViewCell.swift @@ -214,10 +214,10 @@ final class FallingUserCollectionViewCell: TFBaseCollectionViewCell { } func dotPosition(progress: CGFloat, rect: CGRect) -> CGPoint { - let progress = round(progress * 100) / 100 // 오차를 줄이기 위함 let radius = CGFloat(rect.height / 2 - cardTimeView.timerView.strokeLayer.lineWidth / 2) - - var angle = 2 * CGFloat.pi * progress - CGFloat.pi / 2 + CGFloat.pi / 6 // 두 원의 중점과 원점이 이루는 각도를 30도로 가정 + + // 3 / 2 pi(정점 각도) -> - 1 / 2 pi(정점) + var angle = 2 * CGFloat.pi * progress - CGFloat.pi / 2 + CGFloat.pi / 10 // 두 원의 중점과 원점이 이루는 각도를 18도로 가정 if angle <= -CGFloat.pi / 2 || CGFloat.pi * 1.5 <= angle { angle = -CGFloat.pi / 2 // 정점 각도 } @@ -266,7 +266,9 @@ extension Reactive where Base: FallingUserCollectionViewCell { base.cardTimeView.progressView.progress = timeState.getProgress - let strokeEnd = timeState.getProgress + // 소수점 3번 째자리까지 표시하면 오차가 발생해서 2번 째자리까지만 표시 + let strokeEnd = round(timeState.getProgress * 100) / 100 + base.cardTimeView.timerView.dotLayer.position = base.dotPosition(progress: strokeEnd, rect: base.cardTimeView.timerView.bounds) base.cardTimeView.timerView.strokeLayer.strokeEnd = strokeEnd