Exemple #1
0
        protected virtual bool InitializeFromToValues(ColorPairAsset fromToValues)
        {
            if (fromToValues == null)
            {
                Debug.LogError("Missing Input type ColorPairAsset.", gameObject);
                return(false);
            }

            StartNewTween();
            startColor = fromToValues.A;
            endColor   = fromToValues.B;
            return(true);
        }
        public void AnimateMaterialColor(ColorPairAsset fromToValues, bool instance)
        {
            var initialized = StartAnimateMaterialColor(fromToValues, instance);

            if (!initialized)
            {
                return;
            }

            var tween = LeanTween.value(gameObject, UpdateColor, startColor, endColor, animationSettings.Duration)
                        .setOnComplete(OnColorComplete);

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

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

            if (animationSettings.Type == LTAnimationAsset.AnimationType.Relative)
            {
                var current = material.GetColor(targetParameter.Hash);
                startColor += current;
                endColor   += current;
            }

            UpdateColor(startColor);
            return(true);
        }
Exemple #4
0
        public bool StartAnimateImageColor(ColorPairAsset fromToValues)
        {
            var initialized = ValidateTargetImage() && InitializeFromToValues(fromToValues);

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

            if (animationSettings.Type == LTAnimationAsset.AnimationType.Relative)
            {
                startColor += targetImage.color;
                endColor   += targetImage.color;
            }

            UpdateImageColor(startColor);

            return(true);
        }