在下面的示例中,我需要同时执行所有动画。但只在最后一个起作用。
<g>
<animateTransform attributeName="transform" attributeType="XML"
type="rotate" values="2 100 100; -1 100 100; 1 100 100; -0.5 100 100 0.5 100 100" begin="indefinite" dur="0.35s" fill="freeze" />
<animateTransform attributeName="transform" attributeType="XML"
type="scale" values="1; 1.2; 1" begin="indefinite" dur="0.35s" fill="freeze" />
<animateTransform attributeName="transform" attributeType="XML"
type="translate" values="0 0; -100 -100; 0; 0" begin="indefinite" dur="0.35s" fill="freeze" />
<image x="0" y="0" width="200" height="200" xlink:href="<?php echo $cck->getValue('project_icon'); ?>" />
</g>js触发了以下行动:
var animations = $( $this ).find( 'animateTransform' );
animations[0].beginElement();
animations[1].beginElement();
animations[2].beginElement();发布于 2014-07-06 07:10:32
您的脚本中几乎没有错误:
Begin=“不定”
应:
RepeatCount=“不定”
在旋转值中,您忘记了用分号分隔最后一个值,并且在translate部分中有一个额外的分号。
为了执行少量的转换,您需要通过添加(不需要将其添加到第一个转换)来对结果进行求和。
additive="sum“
因此,您的代码应该如下所示:
<g>
<animateTransform attributeName="transform" attributeType="XML"
type="rotate" values="2 100 100;-1 100 100;1 100 100;-0.5 100 100;0.5 100 100" repeatCount="indefinite" dur="0.35s" fill="freeze" />
<animateTransform attributeName="transform" attributeType="XML"
type="scale" values="1;1.2;1" repeatCount="indefinite" dur="0.35s" fill="freeze" additive="sum"/>
<animateTransform attributeName="transform" attributeType="XML"
type="translate" values="0 0;-100 -100;0 0" repeatCount="indefinite" dur="0.35s" fill="freeze" additive="sum"/>
<image x="0" y="0" width="200" height="200" xlink:href="<?php echo $cck->getValue('project_icon'); ?>" />
</g>顺便说一下,在0.5度旋转你的图像是不明显的,所以为什么要麻烦呢?!
在这里你可以读到更多关于它的信息:SVG-SMIL animation tutorial
https://stackoverflow.com/questions/23736938
复制相似问题