LinearGradientFilling
LinearGradientFilling[{col1,col2,…,coln}]
is a two-dimensional graphics directive specifying that faces of polygons and other filled graphics objects are to be drawn using a progressive transition between colors coli along a straight horizontal line.
LinearGradientFilling[{pos1,pos2,…,posn}{col1,col2,…,coln}]
uses the colors coli at the scaled positions posi.
LinearGradientFilling[{pos1,pos2,…,posn}{col1,col2,…,coln},dir]
draws along the straight line with a direction dir.
LinearGradientFilling[{pos1,…,posn}{col1,…,coln},dir,padding]
uses the specified padding when drawing beyond the boundary positions pos1 and posn.
Details
- LinearGradientFilling is also know as linear, horizontal, vertical or angular gradient.
- LinearGradientFilling is typically used to fill a region with a range of position-dependent colors.
- LinearGradientFilling[{col1,col2,…,coln}] specifies a progressive transition between coli along the x axis of the bounding box of a graphic object.
- LinearGradientFilling[] is effectively equivalent to LinearGradientFilling[{Black,White}].
- LinearGradientFilling["scheme"] uses the specified color scheme in ColorData.
- LinearGradientFilling[{pos1,pos2,…,posn}{col1,col2,…,coln}] specifies colors coli to use at the scaled position posi taken to be relative to the width of the graphic object.
- ImageScaled can be used to specify the position posi and is taken to be fractions of the whole image region.
- LinearGradientFilling[{pos1col1,pos2col2,…}] is equivalent to LinearGradientFilling[{pos1,pos2,…}{col1,col2,…}].
- LinearGradientFilling[{{pos1,col1},{pos2,col2},…}] is equivalent to LinearGradientFilling[{pos1,pos2,…}{col1,col2,…}].
- With a numerical value θ, LinearGradientFilling[…,θ] specifies the straight line with angle θ and the orientation of the gradient in direction vector {Cos[θ],Sin[θ]}.
- Possible symbol directions dir in LinearGradientFilling[…,dir] include:
-
Bottom from top to bottom Center from bottom left to top right Left from right to left Right from left to right Top from bottom to top - LinearGradientFilling[colors] is effectively equivalent to LinearGradientFilling[colors,Right].
- LinearGradientFilling[{pos1,…,posn}{col1,…,coln},dir,padding] specifies the padding to use when drawing beyond the original range of positions between pos1 and posn.
- Possible settings for padding include:
-
"Fixed" repetitions of the colors "Periodic" cyclic repetitions of all the colors "Reflected" reflections of the colors - LinearGradientFilling[colors,dir] is effectively equivalent to LinearGradientFilling[colors,dir,"Fixed"].
Examples
open allclose allBasic Examples (3)
Scope (14)
Basic Uses (6)
Specifications (8)
LinearGradientFilling with no arguments draws a progressive transition from Black to White:
Specify the scaled position of each color:
Scaled positions are taken to be relative to the width of the graphic objects:
Specify color positions by fractions of the whole image:
Use predefined color schemes from ColorData:
Draw a linear gradient at an angle θ in radians:
Specify what padding when drawing beyond the bounding positions:
Applications (13)
Basic Applications (3)
Gradient Colors (3)
Collection of gradient colors in ColorData:
Collection of gradient colors in the Wolfram Data Repository:
Graphics (3)
Apply gradient fillings to graphics primitives:
Apply gradient fillings to Text:
Add a gradient background to graphics objects:
Properties & Relations (5)
LinearGradientFilling uses the color space of the specified colors:
The linear gradient with colors in HSB color space:
Different colors can be given at a single position to generate hard stops:
LinearGradientImage returns an image with linear blend of colors:
Use Blend to generate an array of blended colors:
VertexColors interpolate between colors:
Possible Issues (2)
When colors are specified with the same color space, that space is used for interpolation:
When colors are specified using different color spaces, interpolation happens in the color space of the first color:
Grayscale color space is interpreted as RGB color space:
Color directives are preceded by LinearGradientFilling:
Text
Wolfram Research (2020), LinearGradientFilling, Wolfram Language function, https://reference.wolfram.com/language/ref/LinearGradientFilling.html.
CMS
Wolfram Language. 2020. "LinearGradientFilling." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/LinearGradientFilling.html.
APA
Wolfram Language. (2020). LinearGradientFilling. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/LinearGradientFilling.html