Exemplo n.º 1
0
        internal static _ColorsAndStops _interpolateColorsAndStops(
            List <Color> aColors,
            List <float> aStops,
            List <Color> bColors,
            List <float> bStops,
            float t)
        {
            D.assert(aColors.Count >= 2);
            D.assert(bColors.Count >= 2);
            D.assert(aStops.Count == aColors.Count);
            D.assert(bStops.Count == bColors.Count);

            SplayTree <float, bool> stops = new SplayTree <float, bool>();

            stops.AddAll(aStops);
            stops.AddAll(bStops);

            List <float> interpolatedStops  = stops.Keys.ToList();
            List <Color> interpolatedColors = interpolatedStops.Select <float, Color>((float stop) => {
                return(Color.lerp(_sample(aColors, aStops, stop), _sample(bColors, bStops, stop), t));
            }).ToList();

            return(new _ColorsAndStops(interpolatedColors, interpolatedStops));
        }