纳金网
标题:
实现一个简单的小表盘时钟
[打印本页]
作者:
王者再临
时间:
2014-9-24 22:00
标题:
实现一个简单的小表盘时钟
public Transform secondHandPivot;
public Transform minuteHandPivot;
public Transform hourHandPivot;
DateTime time = DateTime.Now;
float seconds = (float)time.Second;
float minutes = (float)time.Minute;
float hours12 = (float)time.Hour % 12;
float angleSeconds = -360 * (seconds / 60);
float angleMinutes = -360 * (minutes / 60);
float angleHours = -360 * (hours12 / 12);
secondHandPivot.localRotation=Quaternion.Euler(0f,0f,angleSeconds);
minuteHandPivot.localRotation=Quaternion.Euler(0f,0f,angleMinutes);
hourHandPivot.localRotation=Quaternion.Euler(0f,0f,angleHours);
欢迎光临 纳金网 (http://rs.narkii.com/club/)
Powered by Discuz! X2.5