-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
46a3df0
commit 76ca4c6
Showing
13 changed files
with
397 additions
and
8 deletions.
There are no files selected for viewing
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
//Taken from https://github.com/azixMcAze/Unity-UIGradient with credit | ||
using UnityEngine; | ||
using UnityEngine.UI; | ||
|
||
[AddComponentMenu("UI/Effects/4 Corners Gradient")] | ||
public class UICornersGradient : BaseMeshEffect { | ||
public Color m_topLeftColor = Color.white; | ||
public Color m_topRightColor = Color.white; | ||
public Color m_bottomRightColor = Color.white; | ||
public Color m_bottomLeftColor = Color.white; | ||
|
||
public override void ModifyMesh(VertexHelper vh) { | ||
if (!enabled) return; | ||
var rect = graphic.rectTransform.rect; | ||
var localPositionMatrix = UIGradientUtils.LocalPositionMatrix(rect, Vector2.right); | ||
|
||
var vertex = default(UIVertex); | ||
for (var i = 0; i < vh.currentVertCount; i++) { | ||
vh.PopulateUIVertex(ref vertex, i); | ||
var normalizedPosition = localPositionMatrix * vertex.position; | ||
vertex.color *= UIGradientUtils.Bilerp(m_bottomLeftColor, m_bottomRightColor, m_topLeftColor, | ||
m_topRightColor, normalizedPosition); | ||
vh.SetUIVertex(vertex, i); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
//Taken from https://github.com/azixMcAze/Unity-UIGradient with credit | ||
using UnityEngine; | ||
using UnityEngine.UI; | ||
|
||
[AddComponentMenu("UI/Effects/Gradient")] | ||
public class UIGradient : BaseMeshEffect { | ||
public Color m_color1 = Color.white; | ||
public Color m_color2 = Color.white; | ||
[Range(-180f, 180f)] public float m_angle; | ||
public bool m_ignoreRatio = true; | ||
|
||
public override void ModifyMesh(VertexHelper vh) { | ||
if (!enabled) return; | ||
var rect = graphic.rectTransform.rect; | ||
var dir = UIGradientUtils.RotationDir(m_angle); | ||
|
||
if (!m_ignoreRatio) | ||
dir = UIGradientUtils.CompensateAspectRatio(rect, dir); | ||
|
||
var localPositionMatrix = UIGradientUtils.LocalPositionMatrix(rect, dir); | ||
|
||
var vertex = default(UIVertex); | ||
for (var i = 0; i < vh.currentVertCount; i++) { | ||
vh.PopulateUIVertex(ref vertex, i); | ||
var localPosition = localPositionMatrix * vertex.position; | ||
vertex.color *= Color.Lerp(m_color2, m_color1, localPosition.y); | ||
vh.SetUIVertex(vertex, i); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.