问题
How could I create the following using Rectangle[]
in Graphics[]
?
回答1:
Using Polygon
, you can
Graphics[{EdgeForm[Black],
Polygon[{{0, 0}, {3, 0}, {3, 1}, {0, 1}},
VertexColors -> {White, Red, Red, White}]}]
回答2:
Also:
Graphics[Raster[{Range[100]/100}, ColorFunction -> (Blend[{White, Red}, #] &)],
AspectRatio -> .3,
Frame -> True,
FrameTicks -> None]
来源:https://stackoverflow.com/questions/8142179/gradient-fill-using-graphics-in-mathematica