【问题标题】:Gradient Fill using Graphics in Mathematica在 Mathematica 中使用图形进行渐变填充
【发布时间】:2011-11-15 19:43:32
【问题描述】:

如何在Graphics[] 中使用Rectangle[] 创建以下内容?

【问题讨论】:

    标签: graphics wolfram-mathematica


    【解决方案1】:

    使用Polygon,您可以

    Graphics[{EdgeForm[Black], 
      Polygon[{{0, 0}, {3, 0}, {3, 1}, {0, 1}}, 
       VertexColors -> {White, Red, Red, White}]}]
    

    【讨论】:

    • 只是为了好玩(需要网络摄像头才能工作):pts = {{0, 0}, {1, 0}, {1, 1}, {0, 1}};图形[{Texture[CurrentImage[]], Polygon[pts, VertexTextureCoordinates -> pts]}]
    • CurrentImage[] - 一个有趣的函数示例,它在在线文档中比在我的机器上运行得更好...... :) 你如何关闭它......跨度>
    • @cormullion 它在这里工作得很好。试试Dynamic@CurrentImage[]。它捕获的第一帧可能是黑色的(需要时间来调整),如果有多个Dynamic,它就会变得有点不可靠。 ImageCapture[] 会打开一个用户界面,让您将其关闭。
    【解决方案2】:

    还有:

    Graphics[Raster[{Range[100]/100}, ColorFunction -> (Blend[{White, Red}, #] &)], 
     AspectRatio -> .3, 
     Frame       -> True, 
     FrameTicks  -> None]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-09-16
      • 1970-01-01
      • 1970-01-01
      • 2022-01-19
      • 1970-01-01
      • 2018-06-30
      • 1970-01-01
      相关资源
      最近更新 更多