static int _m_DOColor(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.UI.Image __cl_gen_to_be_invoked = (UnityEngine.UI.Image)translator.FastGetCSObj(L, 1); { UnityEngine.Color endValue; translator.Get(L, 2, out endValue); float duration = (float)LuaAPI.lua_tonumber(L, 3); DG.Tweening.Tweener __cl_gen_ret = __cl_gen_to_be_invoked.DOColor(endValue, duration); translator.Push(L, __cl_gen_ret); return(1); } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } }
protected override Tween DOPlay() { if (null == m_Image) { return(null); } // end if return(m_Image.DOColor(m_toColor, m_duration)); }
public void setTopGradientState(bool active, bool animated = true) { if (topGradientActive == active) { return; } Color col = new Color(1, 1, 1, active ? 1 : 0); if (animated) { topGradientImage.DOColor(col, 0.35f); } else { topGradientImage.color = col; } topGradientActive = active; }
/// <summary>Tweens an Image's colors using the given gradient /// (NOTE 1: only uses the colors of the gradient, not the alphas - NOTE 2: creates a Sequence, not a Tweener). /// Also stores the image as the tween's target so it can be used for filtered operations</summary> /// <param name="gradient">The gradient to use</param><param name="duration">The duration of the tween</param> public static Sequence DOGradientColor(this UnityEngine.UI.Image target, Gradient gradient, float duration) { Sequence s = DOTween.Sequence(); GradientColorKey[] colors = gradient.colorKeys; int len = colors.Length; for (int i = 0; i < len; ++i) { GradientColorKey c = colors[i]; if (i == 0 && c.time <= 0) { target.color = c.color; continue; } float colorDuration = i == len - 1 ? duration - s.Duration(false) // Verifies that total duration is correct : duration * (i == 0 ? c.time : c.time - colors[i - 1].time); s.Append(target.DOColor(c.color, colorDuration).SetEase(Ease.Linear)); } return(s); }