public void AnimatePositionZ(FloatPairAsset fromToValues)
        {
            var initialized = StartAnimatePositionZ(fromToValues);

            if (!initialized)
            {
                return;
            }

            LTDescr tween;

            if (animationSettings.Space == Space.Self)
            {
                tween = LeanTween.value(gameObject, UpdateLocalPositionZ, startFloat, endFloat, animationSettings.Duration)
                        .setOnComplete(OnLocalPositionZComplete);
            }
            else
            {
                tween = LeanTween.value(gameObject, UpdatePositionZ, startFloat, endFloat, animationSettings.Duration)
                        .setOnComplete(OnPositionZComplete);
            }

            ApplyAdditionalSettings(tween);
            uniqueId = tween.uniqueId;
        }
        public bool StartAnimatePositionZ(FloatPairAsset fromToValues)
        {
            var initialized = ValidateTarget() && InitializeFromToValues(fromToValues);

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

            if (animationSettings.Space == Space.Self)
            {
                if (animationSettings.Type == LTAnimationAsset.AnimationType.Relative)
                {
                    var localPosition = transformTarget.localPosition;
                    startFloat += localPosition.z;
                    endFloat   += localPosition.z;
                }

                UpdateLocalPositionZ(startFloat);
            }
            else
            {
                if (animationSettings.Type == LTAnimationAsset.AnimationType.Relative)
                {
                    var position = transformTarget.position;
                    startFloat += position.z;
                    endFloat   += position.z;
                }

                UpdatePositionZ(startFloat);
            }

            return(true);
        }
Beispiel #3
0
        protected virtual bool InitializeFromToValues(FloatPairAsset fromToValues)
        {
            if (fromToValues == null)
            {
                Debug.LogError("Missing Input type FloatPairAsset.", gameObject);
                return(false);
            }

            StartNewTween();
            startFloat = fromToValues.A;
            endFloat   = fromToValues.B;
            return(true);
        }
        public void AnimateMaterialFloat(FloatPairAsset fromToValues, bool instance)
        {
            var initialized = StartAnimateMaterialFloat(fromToValues, instance);

            if (!initialized)
            {
                return;
            }

            var tween = LeanTween.value(gameObject, UpdateFloat, startFloat, endFloat, animationSettings.Duration)
                        .setOnComplete(OnFloatComplete);

            ApplyAdditionalSettings(tween);
            uniqueId = tween.uniqueId;
        }
Beispiel #5
0
        public void AnimateCanvasGroupAlpha(FloatPairAsset fromToValues)
        {
            var initialized = StartAnimateCanvasGroupAlpha(fromToValues);

            if (!initialized)
            {
                return;
            }

            var tween = LeanTween.value(gameObject, UpdateCanvasGroupAlpha, startFloat, endFloat, animationSettings.Duration)
                        .setOnComplete(OnCanvasGroupAlphaComplete);

            ApplyAdditionalSettings(tween);
            uniqueId = tween.uniqueId;
        }
Beispiel #6
0
        public void AnimateRectTransformHeight(FloatPairAsset fromToValues)
        {
            var initialized = StartAnimateRectTransformHeight(fromToValues);

            if (!initialized)
            {
                return;
            }

            var tween = LeanTween.value(gameObject, UpdateRectTransformHeight, startFloat, endFloat, animationSettings.Duration)
                        .setOnComplete(OnRectTransformHeightComplete);

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

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

            if (animationSettings.Type == LTAnimationAsset.AnimationType.Relative)
            {
                var current = material.GetFloat(targetParameter.Hash);
                startFloat += current;
                endFloat   += current;
            }

            UpdateFloat(startFloat);
            return(true);
        }
Beispiel #8
0
        public bool StartAnimateCanvasGroupAlpha(FloatPairAsset fromToValues)
        {
            var initialized = ValidateTargetCanvasGroup() && InitializeFromToValues(fromToValues);

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

            if (animationSettings.Type == LTAnimationAsset.AnimationType.Relative)
            {
                startFloat += targetCanvasGroup.alpha;
                endFloat   += targetCanvasGroup.alpha;
            }

            UpdateCanvasGroupAlpha(startFloat);

            return(true);
        }
Beispiel #9
0
        public bool StartAnimateRectTransformWidth(FloatPairAsset fromToValues)
        {
            var initialized = ValidateTargetRectTransform() && InitializeFromToValues(fromToValues);

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

            if (animationSettings.Type == LTAnimationAsset.AnimationType.Relative)
            {
                startFloat += targetRectTransform.rect.width;
                endFloat   += targetRectTransform.rect.width;
            }

            UpdateRectTransformWidth(startFloat);

            return(true);
        }
        public void AnimateRotationSpeedZ(FloatPairAsset fromToValues)
        {
            var initialized = ValidateTarget() && InitializeFromToValues(fromToValues);

            if (!initialized)
            {
                return;
            }

            LTDescr tween;

            if (animationSettings.Space == Space.Self)
            {
                if (animationSettings.IgnoreTimeScale)
                {
                    tween = LeanTween.value(gameObject, UpdateLocalRotationSpeedZUnscaledTime, startFloat, endFloat, animationSettings.Duration)
                            .setOnComplete(OnRotationSpeedComplete);
                }
                else
                {
                    tween = LeanTween.value(gameObject, UpdateLocalRotationSpeedZScaledTime, startFloat, endFloat, animationSettings.Duration)
                            .setOnComplete(OnRotationSpeedComplete);
                }
            }
            else
            {
                if (animationSettings.IgnoreTimeScale)
                {
                    tween = LeanTween.value(gameObject, UpdateRotationSpeedZUnscaledTime, startFloat, endFloat, animationSettings.Duration)
                            .setOnComplete(OnRotationSpeedComplete);
                }
                else
                {
                    tween = LeanTween.value(gameObject, UpdateRotationSpeedZScaledTime, startFloat, endFloat, animationSettings.Duration)
                            .setOnComplete(OnRotationSpeedComplete);
                }
            }

            ApplyAdditionalSettings(tween);
            uniqueId = tween.uniqueId;
        }