html - 如何旋转 SVG 六 Angular 形?

标签 html css svg

我只是想对我的六 Angular 形做一些改变,我需要原样的图像,只有形状必须旋转。或者,告诉我实现此目标的任何其他方法。

注意:我需要原样的图像,只有形状必须旋转。

从这个形状:

到这个形状:

谢谢,

这是代码

<html>
  <head>
    <title></title>
  </head>
  <style type="text/css">
svg{
  width:30%;
  margin:0 auto;
}
#hex{
  stroke-width:1;
  stroke: #2f1522;
}

</style>
  <body>
    <svg viewbox="0 0 200 200" version="1.1" xmlns="http://www.w3.org/2000/svg">
  <defs>
    <pattern id="img" patternUnits="userSpaceOnUse" width="100" height="100">
      <image xlink:href="https://farm4.staticflickr.com/3165/5733278274_2626612c70.jpg" x="-40" width="150" height="100" />
    </pattern>
  </defs>
  <polygon id="hex" points="50 1 95 25 95 75 50 99 5 75 5 25" fill="url(#img)"/>
</svg>
  </body>
</html>

最佳答案

改变多边形的坐标。

25,8 75,8 100,50 75,92 25,92 0,50 此坐标创建所需的效果。

Polygon is a closed shape created by connecting the points specified.

enter image description here

<html>

<head>
  <title></title>
</head>
<style type="text/css">
  svg {
    width: 30%;
    margin: 0 auto;
  }
  #hex {
    stroke-width: 1;
    stroke: #2f1522;
  }
</style>

<body>
  <svg viewbox="0 0 200 200" version="1.1" xmlns="http://www.w3.org/2000/svg">
    <defs>
      <pattern id="img" patternUnits="userSpaceOnUse" width="100" height="100">
        <image xlink:href="https://farm4.staticflickr.com/3165/5733278274_2626612c70.jpg" x="-40" width="150" height="100" />
      </pattern>
    </defs>
    <polygon id="hex" points="25 8 75 8 100 50 75 92 25 92 0 50" fill="url(#img)" />
  </svg>
</body>

</html>

关于html - 如何旋转 SVG 六 Angular 形?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37937637/

相关文章:

JQuery - 如果使用 JQuery 检查复选框更改事件不会触发

html - 如何修复 'Hero image with svg on bottom (wave)'

javascript - 使用 SQL 和 PHP 的动态 CSS

javascript - 使用按钮更改多个div的边框颜色

jquery - 根据其中的内容调整表格列的高度

html - 第二个对象上的相同动画不起作用

html - 在不知道原始颜色的情况下在悬停时减轻 svg 部分

javascript - 如何使用 javascript 操作 SVG 元素样式?

html - 没有浏览器可以做webrtc吗?

html - 在 http ://www. apple.com/uk/mac-pro/上使用的这个滚动叫什么