The following XAML example shows a RadialGradientBrush that's set as the Background of a Frame: Then, add two or more GradientStop objects to the RadialGradientBrush.GradientStops collection, that specify the colors in the gradient and their positions. To create a radial gradient, create a RadialGradientBrush object and set its Center and Radius properties. A gradient stop at 0.0 defines the color at the center of the circle. Therefore, a gradient stop at 1.0 defines the color at the circle's circumference. The circle defines the end point of the gradient. The position and size of the circle can be changed using the brush's Center and Radius properties. The gradient axis radiates from the center of the circle to its circumference. Create a RadialGradientBrushĪ radial gradient brush's gradient stops are positioned along a gradient axis defined by a circle. Radial gradients can also be created with the radial-gradient() CSS function. The RadialGradientBrush class also has an IsEmpty method that returns a bool that represents whether the brush has been assigned any GradientStop objects. These properties are backed by BindableProperty objects, which means that they can be targets of data bindings, and styled. The default value of this property is 0.5.
peru will start from the bottom right and transition towards seashell ending in the top-left corner.īesides simple directional transitions, we can make repeating linear patterns as well. The to top left keyword will be typed first, followed by the first color, in this instance peru and finally with the second color seashell. Let’s take a look at a linear gradient with to top left keyword.īackground: linear-gradient(to top left, peru, seashell) You can specify box corners with keywords, such as to top left.
If you want to point your gradient to the right, you can use 90deg or to right keyword. Positive angle numbers rotate clockwise, negative numbers rotate counterclockwise. The keywords correspond to respective angles. You can control the direction of the gradient line with angles, deg, or by using keywords such as to top or to right.
peru will be the top color and will gradually fade to seashell, our second or bottom color. Top to bottom is the default transition for linear-gradient(). Top to bottom gradient using peru and seashell color keywords.īackground: linear-gradient(peru, seashell) Syntax: background-image: linear-gradient(angle, color-stop1, color-stop2, color-hints) įirst up is the default linear gradient. You use the linear-gradient() function to generate linear gradients. Linear gradients can be made by defining a minimum of two color stops. This is handy when creating stripe or checker patterns. The current CSS specification has three types of gradients. You can use this transition to apply subtle shading in background images, information cards, buttons, and other web images. A gradient is an image that progressively transitions between two or more colors.
Gradients fall under the CSS Images Module.