类型 LinearGradient

API 文档由 Go 源码生成,内容为英文。

type LinearGradient struct {
	Start, End Point
	From, To   Color
}

LinearGradient is a two-color linear gradient in an icon's view-box units: From at Start, To at End, held flat beyond both (SVG's spreadMethod "pad"), mixed as straight RGBA like SVG. Renderers interpolate colors across a triangle, so the canvas cuts the layer's triangles at the two lines where the gradient starts and ends: the pieces beyond are flat, the ones between carry the gradient as the colors of their vertices, which is exact. The tessellation is cached with the icon, so a gradient costs a replay no more than a solid layer.

方法

At#

func (gradient LinearGradient) At(t float32) Color

At returns the gradient color at t, 0 at Start and 1 at End.