Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ Includes a SRP shader for blurring the background of UI panels.
#### Using UnityPackageManager (for Unity 2019.3 or later)
Open the package manager window (menu: Window > Package Manager)<br/>
Select "Add package from git URL...", fill in the pop-up with the following link:<br/>
https://github.com/coryleach/UnityGUI.git#3.0.8<br/>
https://github.com/coryleach/UnityGUI.git#3.0.9<br/>

#### Using UnityPackageManager (for Unity 2019.1 or later)

Find the manifest.json file in the Packages folder of your project and edit it to look like this:
```js
{
"dependencies": {
"com.gameframe.gui": "https://github.com/coryleach/UnityGUI.git#3.0.8",
"com.gameframe.gui": "https://github.com/coryleach/UnityGUI.git#3.0.9",
...
},
}
Expand Down
25 changes: 25 additions & 0 deletions Runtime/Tween/MaterialTweenExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System.Threading.Tasks;
using UnityEngine;

namespace Gameframe.GUI.Tween
{
public static class MaterialTweenExtensions
{
public static async Task DoFloatAsync(this Material material, int propertyId, float startValue, float endValue, float duration, Easing easing = Easing.Linear, AnimationCurve customCurve = null)
{
await TweenExtensions.DoTweenAsync(material.GetInstanceID(), duration, (t) =>
{
material.SetFloat(propertyId, Mathf.Lerp(startValue, endValue, t));
}, easing, customCurve);
}

public static async Task DoFloatAsync(this Material material, string propertyName, float startValue, float endValue, float duration, Easing easing = Easing.Linear, AnimationCurve customCurve = null)
{
var propertyId = Shader.PropertyToID(propertyName);
await TweenExtensions.DoTweenAsync(material.GetInstanceID(), duration, (t) =>
{
material.SetFloat(propertyId, Mathf.Lerp(startValue, endValue, t));
}, easing, customCurve);
}
}
}
3 changes: 3 additions & 0 deletions Runtime/Tween/MaterialTweenExtensions.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion Runtime/Tween/TweenExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ public static void DoKillTweens(this GameObject obj)
}

public static void DoKillTweens(this Component obj)
{
CancelTweensForId(obj.gameObject.GetInstanceID());
}

public static void DoKillTweens(this UnityEngine.Object obj)
{
CancelTweensForId(obj.GetInstanceID());
}
Expand Down Expand Up @@ -144,7 +149,7 @@ private static void CompleteTween(int id)
_tweenDict.Remove(id);
}

private static void CancelTweensForId(int id)
public static void CancelTweensForId(int id)
{
if (!_tweenDict.TryGetValue(id, out var tweenData))
{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "com.gameframe.gui",
"displayName": "Gameframe.GUI",
"version": "3.0.8",
"version": "3.0.9",
"description": "This is a library of GUI helpers for UGUI \r\nIncludes a panel system that implements a navigation stack. \r\nIncludes a scene transition system. \r\nIncludes a SRP shader for blurring the background of UI panels.",
"keywords": [],
"author": {
Expand Down