protected void PanelScaleAnimation(GameObject obj, AnimationBeingTargetField target, float alpha)
    {
        Vector3 res = target.GetAnimationVectorStruct().initial *(1 - alpha) + target.GetAnimationVectorStruct().target *alpha;

        //Debug.Log(res);
        obj.transform.localScale = res;
    }
Beispiel #2
0
    void ScaleAnim(GameObject g, AnimationBeingTargetField field, float alpha)
    {
        Vector3 res = field.GetAnimationVectorStruct().initial *(1 - alpha) + field.GetAnimationVectorStruct().target *alpha;

        //Debug.Log(res);
        g.transform.localScale = res;
    }
Beispiel #3
0
    public AnimationBeing CreateScaleAnim(GameObject objRef, Vector3 initial, Vector3 target, AnimationType animType, float duration, int direction, bool loop = false)
    {
        AnimationBeingTargetField t = new AnimationBeingTargetField();

        t.SetAnimationVectorStruct(new AnimationVectorStuct(initial, target));

        System.Action <GameObject, AnimationBeingTargetField, float> func = null;
        func = (GameObject obj, AnimationBeingTargetField field, float alpha) =>
        {
            Vector3 res = field.GetAnimationVectorStruct().initial *(1 - alpha) + field.GetAnimationVectorStruct().target *alpha;
            //Debug.Log(res);
            obj.transform.localScale = res;
        };

        //animation being creation
        AnimationBeing being = new AnimationBeing(objRef, func, duration, direction);

        being.SetLoop(loop);
        being.CreateAnimationBeingTargetAndInitializeDefaultValue(t.GetAnimationVectorStruct());

        switch (animType)
        {
        case AnimationType.Parallel:
            Debug.Log("Created");
            animationBeingsParallel.Add(being);
            break;

        case AnimationType.Serial:
            animationBeingsSequence.Add(being);
            break;
        }
        return(being);
    }
Beispiel #4
0
    public AnimationBeing CreateRectTransformLocalPositionAnimation(RectTransform rectTransform,
                                                                    Vector3 initial, Vector3 target, AnimationType animType, float duration, int direction = 1, bool loop = false)
    {
        AnimationBeingTargetField t = new AnimationBeingTargetField();

        t.SetAnimationVectorStruct(new AnimationVectorStuct(initial, target));

        System.Action <GameObject, AnimationBeingTargetField, float> func = null;
        func = (GameObject obj, AnimationBeingTargetField field, float alpha) =>
        {
            //Vector3 res = t.GetAnimationVectorStruct().initial * (1 - alpha) + t.GetAnimationVectorStruct().target * alpha;
            obj.GetComponent <RectTransform>().localPosition = field.GetAnimationVectorStruct().initial *(1 - alpha) +
                                                               field.GetAnimationVectorStruct().target *alpha;

            //material.SetFloat(property, alpha);
        };

        //animation being creation
        AnimationBeing being = new AnimationBeing(rectTransform.gameObject, func, duration, direction);

        being.SetLoop(loop);
        being.CreateAnimationBeingTargetAndInitializeDefaultValue(t.GetAnimationVectorStruct());

        switch (animType)
        {
        case AnimationType.Parallel:
            Debug.Log("Created");
            animationBeingsParallel.Add(being);
            break;

        case AnimationType.Serial:
            animationBeingsSequence.Add(being);
            break;
        }
        return(being);
    }