You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
public class Skewable : BaseMeshEffect {
|
|
|
|
|
|
|
|
|
|
public float skew = 1.0f;
|
|
|
|
|
readonly List<UIVertex> verts = new List<UIVertex>();
|
|
|
|
|
public override void ModifyMesh(VertexHelper vh) {
|
|
|
|
|
if (!IsActive())
|
|
|
|
|
return;
|
|
|
|
|
vh.GetUIVertexStream(verts);
|
|
|
|
|
for (int i = 0; i < verts.Count; ++i) {
|
|
|
|
|
UIVertex pos = verts[i];
|
|
|
|
|
//just need to find the factor to match whatever your animator set in skew
|
|
|
|
|
pos.position.x += pos.position.y * skew;
|
|
|
|
|
verts[i] = pos;
|
|
|
|
|
}
|
|
|
|
|
vh.Clear();
|
|
|
|
|
vh.AddUIVertexTriangleStream(verts);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|