【问题标题】:KonvaJS apply transform matrix to React.ShapeKonvaJS 将变换矩阵应用于 React.Shape
【发布时间】:2018-02-16 02:55:19
【问题描述】:

鉴于 SVG 中的以下矩形。

<rect xmlns="http://www.w3.org/2000/svg" x="72.036" y="156.473" transform="matrix(0.1727 -0.985 0.985 0.1727 -83.7081 215.7814)" style="fill:none;stroke:#020202;stroke-width:0.5;stroke-miterlimit:10;" width="29.129" height="2.498"/>

矩形上方希望在 KonvaJS 中相应地呈现为 Konva.Rect https://konvajs.github.io/api/Konva.Rect.html

基于矩阵的分解,应应用以下内容: 翻译(-83.7081, 215.781) 旋转(-80.0554125754873) 规模(1.0000251446838724)

据我了解,可以应用旋转、缩放和倾斜,但如何应用平移值? 应该将它们添加到 x 和 y 还是添加到 offsetX/offsetY?

或者有没有办法将 Transform 类应用于 Rect?

谢谢。

【问题讨论】:

    标签: transform konvajs


    【解决方案1】:

    您应该使用{x,y} 属性。

    或者有没有办法将 Transform 类应用于 Rect?

    不,公共 API 不允许这样做。

    【讨论】:

      猜你喜欢
      • 2012-12-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-05
      • 2016-05-15
      • 1970-01-01
      • 2014-03-31
      相关资源
      最近更新 更多