Skip to content

Instantly share code, notes, and snippets.

@jasonjk192
Created May 18, 2025 09:36
Show Gist options
  • Select an option

  • Save jasonjk192/ada325b0a108ca77abe036a6016eca60 to your computer and use it in GitHub Desktop.

Select an option

Save jasonjk192/ada325b0a108ca77abe036a6016eca60 to your computer and use it in GitHub Desktop.
Unity DOTween integration for UIEffect (by mob-sakai)
using Coffee.UIEffects;
using DG.Tweening;
using UnityEngine;
public static class UIEffectDOTweenExtensions
{
#region TONE_FILTER
public static Tween DOToneIntensity(this UIEffect effect, float endValue, float duration)
{
return DOTween.To(() => effect.toneIntensity, x => effect.toneIntensity = x, endValue, duration);
}
#endregion
#region COLOR_FILTER
public static Tween DOColorIntensity(this UIEffect effect, float endValue, float duration)
{
return DOTween.To(() => effect.colorIntensity, x => effect.colorIntensity = x, endValue, duration);
}
public static Tween DOColor(this UIEffect effect, Color endValue, float duration)
{
return DOTween.To(() => effect.color, x => effect.color = x, endValue, duration);
}
#endregion
#region SAMPLING_FILTER
public static Tween DOSamplingIntensity(this UIEffect effect, float endValue, float duration)
{
return DOTween.To(() => effect.samplingIntensity, x => effect.samplingIntensity = x, endValue, duration);
}
public static Tween DOSamplingWidth(this UIEffect effect, float endValue, float duration)
{
return DOTween.To(() => effect.samplingWidth, x => effect.samplingWidth = x, endValue, duration);
}
#endregion
#region TRANSITION_FILTER
public static Tween DOTransitionRate(this UIEffect effect, float endValue, float duration)
{
return DOTween.To(() => effect.transitionRate, x => effect.transitionRate = x, endValue, duration);
}
public static Tween DOTransitionRotation(this UIEffect effect, float endValue, float duration)
{
return DOTween.To(() => effect.transitionRotation, x => effect.transitionRotation = x, endValue, duration);
}
public static Tween DOTransitionTextureScale(this UIEffect effect, Vector2 endValue, float duration)
{
return DOTween.To(() => effect.transitionTextureScale, x => effect.transitionTextureScale = x, endValue, duration);
}
public static Tween DOTransitionTextureOffset(this UIEffect effect, Vector2 endValue, float duration)
{
return DOTween.To(() => effect.transitionTextureOffset, x => effect.transitionTextureOffset = x, endValue, duration);
}
public static Tween DOTransitionTextureSpeed(this UIEffect effect, Vector2 endValue, float duration)
{
return DOTween.To(() => effect.transitionTextureSpeed, x => effect.transitionTextureSpeed = x, endValue, duration);
}
public static Tween DOTransitionAutoPlaySpeed(this UIEffect effect, float endValue, float duration)
{
return DOTween.To(() => effect.transitionAutoPlaySpeed, x => effect.transitionAutoPlaySpeed = x, endValue, duration);
}
public static Tween DOTransitionWidth(this UIEffect effect, float endValue, float duration)
{
return DOTween.To(() => effect.transitionWidth, x => effect.transitionWidth = x, endValue, duration);
}
public static Tween DOTransitionSoftness(this UIEffect effect, float endValue, float duration)
{
return DOTween.To(() => effect.transitionSoftness, x => effect.transitionSoftness = x, endValue, duration);
}
public static Tween DOTransitionColor(this UIEffect effect, Color endValue, float duration)
{
return DOTween.To(() => effect.transitionColor, x => effect.transitionColor = x, endValue, duration);
}
#endregion
#region TARGET_MODE
public static Tween DOTargetColor(this UIEffect effect, Color endValue, float duration)
{
return DOTween.To(() => effect.targetColor, x => effect.targetColor = x, endValue, duration);
}
public static Tween DOTargetRange(this UIEffect effect, float endValue, float duration)
{
return DOTween.To(() => effect.targetRange, x => effect.targetRange = x, endValue, duration);
}
public static Tween DOTargetSoftness(this UIEffect effect, float endValue, float duration)
{
return DOTween.To(() => effect.targetSoftness, x => effect.targetSoftness = x, endValue, duration);
}
#endregion
#region SHADOW_MODE
public static Tween DOShadowDistance(this UIEffect effect, Vector2 endValue, float duration)
{
return DOTween.To(() => effect.shadowDistance, x => effect.shadowDistance = x, endValue, duration);
}
public static Tween DOShadowIteration(this UIEffect effect, int endValue, float duration)
{
return DOTween.To(() => effect.shadowIteration, x => effect.shadowIteration = x, endValue, duration);
}
public static Tween DOShadowColor(this UIEffect effect, Color endValue, float duration)
{
return DOTween.To(() => effect.shadowColor, x => effect.shadowColor = x, endValue, duration);
}
public static Tween DOShadowFade(this UIEffect effect, float endValue, float duration)
{
return DOTween.To(() => effect.shadowFade, x => effect.shadowFade = x, endValue, duration);
}
public static Tween DoShadowMirrorScale(this UIEffect effect, float endValue, float duration)
{
return DOTween.To(() => effect.shadowMirrorScale, x => effect.shadowMirrorScale = x, endValue, duration);
}
#endregion
#region GRADIATION_MODE
public static Tween DOGradiationColor1(this UIEffect effect, Color endValue, float duration)
{
return DOTween.To(() => effect.gradationColor1, x => effect.gradationColor1 = x, endValue, duration);
}
public static Tween DOGradiationColor2(this UIEffect effect, Color endValue, float duration)
{
return DOTween.To(() => effect.gradationColor2, x => effect.gradationColor2 = x, endValue, duration);
}
public static Tween DOGradiationColor3(this UIEffect effect, Color endValue, float duration)
{
return DOTween.To(() => effect.gradationColor3, x => effect.gradationColor3 = x, endValue, duration);
}
public static Tween DOGradiationColor4(this UIEffect effect, Color endValue, float duration)
{
return DOTween.To(() => effect.gradationColor4, x => effect.gradationColor4 = x, endValue, duration);
}
public static Tween DoGradiationIntensity(this UIEffect effect, float endValue, float duration)
{
return DOTween.To(() => effect.gradationIntensity, x => effect.gradationIntensity = x, endValue, duration);
}
public static Tween DoGradiationOffset(this UIEffect effect, float endValue, float duration)
{
return DOTween.To(() => effect.gradationOffset, x => effect.gradationOffset = x, endValue, duration);
}
public static Tween DoGradiationScale(this UIEffect effect, float endValue, float duration)
{
return DOTween.To(() => effect.gradationScale, x => effect.gradationScale = x, endValue, duration);
}
public static Tween DoGradiationRotation(this UIEffect effect, float endValue, float duration)
{
return DOTween.To(() => effect.gradationRotation, x => effect.gradationRotation = x, endValue, duration);
}
#endregion
#region EDGE_MODE
public static Tween DoEdgeWidth(this UIEffect effect, float endValue, float duration)
{
return DOTween.To(() => effect.edgeWidth, x => effect.edgeWidth = x, endValue, duration);
}
public static Tween DOEdgeColor(this UIEffect effect, Color endValue, float duration)
{
return DOTween.To(() => effect.edgeColor, x => effect.edgeColor = x, endValue, duration);
}
public static Tween DoEdgeShinyRate(this UIEffect effect, float endValue, float duration)
{
return DOTween.To(() => effect.edgeShinyRate, x => effect.edgeShinyRate = x, endValue, duration);
}
public static Tween DoEdgeShinyWidth(this UIEffect effect, float endValue, float duration)
{
return DOTween.To(() => effect.edgeShinyWidth, x => effect.edgeShinyWidth = x, endValue, duration);
}
public static Tween DoEdgeShinyAutoPlaySpeed(this UIEffect effect, float endValue, float duration)
{
return DOTween.To(() => effect.edgeShinyAutoPlaySpeed, x => effect.edgeShinyAutoPlaySpeed = x, endValue, duration);
}
#endregion
#region DETAIL_FILTER
public static Tween DoDetailTextureScale(this UIEffect effect, Vector2 endValue, float duration)
{
return DOTween.To(() => effect.detailTextureScale, x => effect.detailTextureScale = x, endValue, duration);
}
public static Tween DoDetailTextureOffset(this UIEffect effect, Vector2 endValue, float duration)
{
return DOTween.To(() => effect.detailTextureOffset, x => effect.detailTextureOffset = x, endValue, duration);
}
public static Tween DoDetailTextureSpeed(this UIEffect effect, Vector2 endValue, float duration)
{
return DOTween.To(() => effect.detailTextureSpeed, x => effect.detailTextureSpeed = x, endValue, duration);
}
public static Tween DoDetailIntensity(this UIEffect effect, float endValue, float duration)
{
return DOTween.To(() => effect.detailIntensity, x => effect.detailIntensity = x, endValue, duration);
}
public static Tween DODetailColor(this UIEffect effect, Color endValue, float duration)
{
return DOTween.To(() => effect.detailColor, x => effect.detailColor = x, endValue, duration);
}
#endregion
}
@jasonjk192
Copy link
Author

Quick collection of DOTween implementation for some of the options present in UIEffect. Made this for myself to quickly add simple tweens that can be used in DOTween sequences. It's not even remotely complete (could add shake and punch also) but just wanted to share if yall want some quick and easy extensions. Feel free to edit and add in more!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment