public static RadialGradient lerp(RadialGradient a, RadialGradient b, float t) { if (a == null && b == null) { return(null); } if (a == null) { return((RadialGradient)b.scale(t)); } if (b == null) { return((RadialGradient)a.scale(1.0f - t)); } _ColorsAndStops interpolated = _ColorsAndStops._interpolateColorsAndStops( a.colors, a._impliedStops(), b.colors, b._impliedStops(), t); return(new RadialGradient( center: AlignmentGeometry.lerp(a.center, b.center, t), radius: Mathf.Max(0.0f, MathUtils.lerpNullableFloat(a.radius, b.radius, t)), colors: interpolated.colors, stops: interpolated.stops, tileMode: t < 0.5 ? a.tileMode : b.tileMode, focal: AlignmentGeometry.lerp(a.focal, b.focal, t), focalRadius: Mathf.Max(0.0f, MathUtils.lerpNullableFloat(a.focalRadius, b.focalRadius, t)) )); }
public static LinearGradient lerp(LinearGradient a, LinearGradient b, float t) { if (a == null && b == null) { return(null); } if (a == null) { return((LinearGradient)b.scale(t)); } if (b == null) { return((LinearGradient)a.scale(1.0f - t)); } _ColorsAndStops interpolated = _ColorsAndStops._interpolateColorsAndStops( a.colors, a._impliedStops(), b.colors, b._impliedStops(), t); return(new LinearGradient( begin: AlignmentGeometry.lerp(a.begin, b.begin, t), end: AlignmentGeometry.lerp(a.end, b.end, t), colors: interpolated.colors, stops: interpolated.stops, tileMode: t < 0.5 ? a.tileMode : b.tileMode )); }
public LinearGradient( AlignmentGeometry begin = null, AlignmentGeometry end = null, List <Color> colors = null, List <float> stops = null, TileMode tileMode = TileMode.clamp, GradientTransform transform = null ) : base(colors: colors, stops: stops, transform: transform) { this.begin = begin ?? Alignment.centerLeft; this.end = end ?? Alignment.centerRight; this.tileMode = tileMode; }
public SweepGradient( AlignmentGeometry center = null, float startAngle = 0.0f, float endAngle = Mathf.PI * 2, List <Color> colors = null, List <float> stops = null, TileMode tileMode = TileMode.clamp, GradientTransform transform = null ) : base(colors: colors, stops: stops, transform: transform) { this.center = center ?? Alignment.center; this.startAngle = startAngle; this.endAngle = endAngle; this.tileMode = tileMode; }
public RadialGradient( AlignmentGeometry center = null, float radius = 0.5f, List <Color> colors = null, List <float> stops = null, TileMode tileMode = TileMode.clamp, AlignmentGeometry focal = null, float focalRadius = 0.0f, GradientTransform transform = null ) : base(colors: colors, stops: stops, transform: transform) { this.center = center ?? Alignment.center; this.radius = radius; this.tileMode = tileMode; this.focal = focal; this.focalRadius = focalRadius; }
public DecorationImage( ImageProvider image = null, ImageErrorListener onError = null, ColorFilter colorFilter = null, BoxFit?fit = null, AlignmentGeometry alignment = null, Rect centerSlice = null, ImageRepeat repeat = ImageRepeat.noRepeat, bool matchTextDirection = false ) { D.assert(image != null); this.image = image; this.onError = onError; this.colorFilter = colorFilter; this.fit = fit; this.alignment = alignment ?? Alignment.center; this.centerSlice = centerSlice; this.repeat = repeat; this.matchTextDirection = matchTextDirection; }