VixenModules.App.Curves.Curve.GetValue C# (CSharp) Метод

GetValue() публичный Метод

public GetValue ( double x ) : double
x double
Результат double
        public virtual double GetValue(double x)
        {
            if (x > 100.0) x = 100.0;
            if (x < 0.0) x = 0.0;

            double returnValue = Points.InterpolateX(x);

            if (returnValue > 100.0) returnValue = 100.0;
            if (returnValue < 0.0) returnValue = 0.0;
            if (double.IsNaN(returnValue))
            {
                returnValue = 100;
            }

            return returnValue;
        }

Same methods

Curve::GetValue ( int x ) : double

Usage Example

Пример #1
0
        private static void AddIntentsToElement(Element element, double[] allPointsTimeOrdered, Curve levelCurve, ColorGradient colorGradient, TimeSpan duration, EffectIntents elementData, bool allowZeroIntensity, Color? color = null)
        {
            if (element != null)
            {
                double lastPosition = allPointsTimeOrdered[0];
                TimeSpan lastEnd = TimeSpan.Zero;
                for (var i = 1; i < allPointsTimeOrdered.Length; i++)
                {
                    double position = allPointsTimeOrdered[i];
                    TimeSpan startTime = lastEnd;
                    TimeSpan timeSpan = TimeSpan.FromMilliseconds(duration.TotalMilliseconds * (position - lastPosition));

                    if (color == null)
                    {
                        var startColor = colorGradient.GetColorAt(lastPosition);
                        var endColor = colorGradient.GetColorAt(position);
                        var startIntensity = levelCurve.GetValue(lastPosition * 100) / 100;
                        var endIntensity = levelCurve.GetValue(position * 100) / 100;

                        if (allowZeroIntensity || !(startIntensity.Equals(0) && endIntensity.Equals(0)))
                        {
                            IIntent intent = IntentBuilder.CreateIntent(startColor, endColor, startIntensity, endIntensity, timeSpan);
                            elementData.AddIntentForElement(element.Id, intent, startTime);
                        }
                    }
                    else
                    {
                        var startIntensity = (colorGradient.GetProportionOfColorAt(lastPosition, (Color)color) * levelCurve.GetValue(lastPosition * 100) / 100);
                        var endIntensity = (colorGradient.GetProportionOfColorAt(position, (Color)color) * levelCurve.GetValue(position * 100) / 100);

                        if (allowZeroIntensity || !(startIntensity.Equals(0) && endIntensity.Equals(0)))
                        {
                            IIntent intent = IntentBuilder.CreateDiscreteIntent((Color)color, startIntensity, endIntensity, timeSpan);
                            elementData.AddIntentForElement(element.Id, intent, startTime);
                        }

                    }

                    lastPosition = position;
                    lastEnd = startTime + timeSpan;
                }
            }
        }
All Usage Examples Of VixenModules.App.Curves.Curve::GetValue