Beispiel #1
0
    public static void PropertyPunch(Material target, AnimatedProperty animatedProperties, UnityAction onStartCallback = null, UnityAction onCompleteCallback = null)
    {
        var p = animatedProperties.property;

        if (p.propertyType == ShaderPropertyType.Color)
        {
            target.DOColor(p.colorValue, p.propertyID, p.duration / 2)
            .SetId(Utils.GetTweenId(target, AnimationType.Punch, AnimationAction.Property))
            .SetEase(p.ease)
            .OnComplete(() => target.DOColor(p.startColor, p.propertyID, p.duration / 2).SetEase(p.ease));
        }
        else
        {
            target.DOFloat(p.floatValue, p.propertyID, p.duration / 2)
            .SetId(Utils.GetTweenId(target, AnimationType.Punch, AnimationAction.Property))
            .SetEase(p.ease)
            .OnComplete(() => target.DOFloat(p.startValue, p.propertyID, p.duration / 2).SetEase(p.ease));
        }
    }
Beispiel #2
0
 private static string GetTweenId(object target, AnimationType animationType, AnimationAction action) => Utils.GetTweenId(target, animationType, action);