回答編集履歴

1

内容の変更

2020/07/24 06:50

投稿

bboydaisuke
bboydaisuke

スコア5275

test CHANGED
@@ -1 +1,49 @@
1
+ こんな感じでどうでしょう。
2
+
3
+
4
+
5
+ ```csharp
6
+
7
+ using UnityEngine;
8
+
9
+ using DG.Tweening;
10
+
11
+
12
+
13
+ [RequireComponent(typeof(SpriteRenderer))]
14
+
15
+ public class HandController : MonoBehaviour
16
+
17
+ {
18
+
19
+ [SerializeField] float m_time = 0.2f;
20
+
21
+ float m_targetAngle;
22
+
23
+
24
+
25
+ public void RotateForMinutes(int minute)
26
+
27
+ {
28
+
29
+ minute = minute % 60;
30
+
31
+ float angle = 360 * minute / 60;
32
+
33
+ m_targetAngle = angle - m_targetAngle > 30 ? angle - 360f : angle;
34
+
35
+ transform.DOLocalRotate(Vector3.back * m_targetAngle, m_time).SetEase(Ease.OutBack);
36
+
37
+ }
38
+
39
+ }
40
+
41
+ ```
42
+
43
+
44
+
45
+ ![イメージ説明](f3e0449c3f78983df479d293375450a9.gif)
46
+
47
+
48
+
1
- [Unity 時計 針 で検索する](https://www.google.com/search?q=unity+%E6%99%82%E8%A8%88+%E9%87%9D)とその辺のこといた記事がいろいろヒットしますよ
49
+ [DOTween ](https://assetstore.unity.com/packages/tools/animation/dotween-hotween-v2-27676)を使ました。