示例#1
0
        public bool StartAnimateRectTransformMinMaxAnchors(Vector4PairAsset fromToValues)
        {
            var initialized = ValidateTargetRectTransform() && InitializeFromToValues(fromToValues);

            if (!initialized)
            {
                return(false);
            }

            if (animationSettings.Type == LTAnimationAsset.AnimationType.Relative)
            {
                startVector4.x += targetRectTransform.anchorMin.x;
                startVector4.y += targetRectTransform.anchorMin.y;
                startVector4.z += targetRectTransform.anchorMax.x;
                startVector4.w += targetRectTransform.anchorMax.y;

                endVector4.x += targetRectTransform.anchorMin.x;
                endVector4.y += targetRectTransform.anchorMin.y;
                endVector4.z += targetRectTransform.anchorMax.x;
                endVector4.w += targetRectTransform.anchorMax.y;
            }

            UpdateRectTransformMinMaxAnchor(0f);

            return(true);
        }
示例#2
0
        protected virtual bool InitializeFromToValues(Vector4PairAsset fromToValues)
        {
            if (fromToValues == null)
            {
                Debug.LogError("Missing Input type Vector4PairAsset.", gameObject);
                return(false);
            }

            StartNewTween();
            startVector4 = fromToValues.A;
            endVector4   = fromToValues.B;
            return(true);
        }
        public void AnimateMaterialVector4(Vector4PairAsset fromToValues, bool instance)
        {
            var initialized = StartAnimateMaterialVector4(fromToValues, instance);

            if (!initialized)
            {
                return;
            }

            var tween = LeanTween.value(gameObject, UpdateVector4, 0f, 1f, animationSettings.Duration)
                        .setOnComplete(OnVector4Complete);

            ApplyAdditionalSettings(tween);
            uniqueId = tween.uniqueId;
        }
示例#4
0
        public void AnimateRectTransformMinMaxAnchors(Vector4PairAsset fromToValues)
        {
            var initialized = StartAnimateRectTransformMinMaxAnchors(fromToValues);

            if (!initialized)
            {
                return;
            }

            var tween = LeanTween.value(gameObject, UpdateRectTransformMinMaxAnchor, 0, 1, animationSettings.Duration)
                        .setOnComplete(OnRectTransformMinMaxAnchorComplete);

            ApplyAdditionalSettings(tween);
            uniqueId = tween.uniqueId;
        }
        public bool StartAnimateMaterialVector4(Vector4PairAsset fromToValues, bool instance)
        {
            var initialized = (instance ? InitializeMaterialInstance() : InitializeMaterial()) && InitializeFromToValues(fromToValues);

            if (!initialized)
            {
                return(false);
            }

            if (animationSettings.Type == LTAnimationAsset.AnimationType.Relative)
            {
                var current = material.GetVector(targetParameter.Hash);
                startVector4 += current;
                endVector4   += current;
            }

            UpdateVector4(0f);
            return(true);
        }