美文网首页
H5 - svg 动画在某些设备失效

H5 - svg 动画在某些设备失效

作者: 西半球_ | 来源:发表于2020-04-27 11:48 被阅读0次

主要是没有加这两句代码

xmlns:xlink="http://www.w3.org/1999/xlink
<mpath xlink:href="#path1"/>

<animateMotion> 元素的mpath子元素使<animateMotion> 元素能够引用一个外部的<path>元素作为运动路径的定义。

<svg width="100%" height="100%"  viewBox="0 0 500 300"
     xmlns="http://www.w3.org/2000/svg"
     xmlns:xlink="http://www.w3.org/1999/xlink" >

  <rect x="1" y="1" width="498" height="298"
        fill="none" stroke="blue" stroke-width="2" />

  <!-- Draw the outline of the motion path in blue, along
          with three small circles at the start, middle and end. -->
  <path id="path1" d="M100,250 C 100,50 400,50 400,250"
        fill="none" stroke="blue" stroke-width="7.06"  />
  <circle cx="100" cy="250" r="17.64" fill="blue"  />
  <circle cx="250" cy="100" r="17.64" fill="blue"  />
  <circle cx="400" cy="250" r="17.64" fill="blue"  />

  <!-- Here is a triangle which will be moved about the motion path.
       It is defined with an upright orientation with the base of
       the triangle centered horizontally just above the origin. -->
  <path d="M-25,-12.5 L25,-12.5 L 0,-87.5 z"
        fill="yellow" stroke="red" stroke-width="7.06"  >
    <!-- Define the motion path animation -->
    <animateMotion dur="6s" repeatCount="indefinite" rotate="auto" >
       <mpath xlink:href="#path1"/>
    </animateMotion>
  </path>
</svg>

相关文章

  • H5 - svg 动画在某些设备失效

    主要是没有加这两句代码 元素的mpath子元素使 元素能够引用一个外部的 元素作为运动路径的定义。

  • 小程序的iOS和Android兼容问题

    篇一: 1.margin在IOS中失效 在页面中元素使用margin值,在某些IOS设备下会出现失效的情况,而安卓...

  • HTML5新增API

    SVG 定义 矢量图工具, 绘图SVG在H5标准之前就有了, IE对SVG的兼容性非常好 svg与canvas区别...

  • SVG矢量图

    SVG 定义 矢量图工具, 绘图SVG在H5标准之前就有了, IE对SVG的兼容性非常好 svg与canvas区别...

  • svg动图制作之傻瓜教程

    要制作svg动图,巧妇难为无米之炊,首先我们要先有svg图片,下面介绍得到svg动图的三个方法:1.在icomoo...

  • h5界面事件回传原生反应时间研究

    一、问题 使用h5来实现某些界面,有时是方便而且快捷的,但是h5界面在iOS设备上的表现始终有些迟顿感,比如我们在...

  • svg作为background失效

    svg代码抽出来,新建一个svg文件粘贴进去,发现在css的background引入无效 解决方案svg对应的文件...

  • vue使用svg

    vue使用svg 做的一个可视化大屏项目中需要引入svg, 直接绑定svg元素的某些值,在ui给的svg中出现了s...

  • ios点击失效

    h5在ios中点击失效 问题1:直接给元素绑定 click 事件失效 解决:可以改成绑定 touchend 事件 ...

  • 动效解决方案 Lazy Line Painter.js

    一、使用 Lazy Line Painter 轻松创建 SVG 路径动效。你可以在AI中制作出SVG文档,上传到转...

网友评论

      本文标题:H5 - svg 动画在某些设备失效

      本文链接:https://www.haomeiwen.com/subject/jjlywhtx.html