Created
April 15, 2016 13:58
-
-
Save tsubaki/239af678c036dd62bb09b789fc09b0ef to your computer and use it in GitHub Desktop.
テキストを回転するやつの中身
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void modify( ref List<UIVertex> stream ){ | |
// 6文字ずつ進む | |
for (int i = 0, streamCount = stream.Count; i < streamCount; i+= 6) { | |
// 文字の中央を取得(上なら[i+1]) | |
var center = Vector2.Lerp(stream [i].position, stream [i + 3].position , 0.5f) ; | |
// 頂点を回す | |
for (int r = 0; r < 6; r++) { | |
var element = stream [i+r]; | |
var pos = element.position - (Vector3)center;; | |
var newPos = new Vector2( | |
pos.x * Mathf.Cos (angle * Mathf.Deg2Rad) - pos.y * Mathf.Sin (angle * Mathf.Deg2Rad), | |
pos.x * Mathf.Sin (angle * Mathf.Deg2Rad) + pos.y * Mathf.Cos (angle * Mathf.Deg2Rad)); | |
element.position = (Vector3)(newPos + center); | |
stream [i+r] = element; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment