递归动画在SVG以下的工作方式

时间:2018-12-05 05:12:23

标签: javascript svg snap.svg

我指的是以下链接中给出的svg动画 https://codepen.io/thinkdesign/pen/JybJOq 我无法理解递归在这里的工作方式

    var offset = 0;
var animation = function() {
  offset -= 100;
  pattern.animate({ x: offset }, 500, mina.ease, animation);
};

在这里,我们在每次函数调用时更改x轴,因此x轴在某些时候应该超出屏幕。请帮助我了解其工作原理

1 个答案:

答案 0 :(得分:2)

这里的页面没有任何变化。此处要移动的 UIImageView *trash_icon = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ic_delete_record.png"]]; UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; button.frame = CGRectMake(280, 140, 30, 30); //Here is where you change the color of the button. button.tintColor = UIColor.whiteColor; [button setImage: trash_icon.image forState:UIControlStateNormal]; cell.accessoryView = button; 是图案的X偏移量。 SVG x是一种填充,它由在各个方向无限重复的“平铺”组成。 <pattern>具有<pattern>x属性,该属性告诉浏览器从何处开始平铺。动画化图案的y偏移量的效果是使它看起来像瓦片在对象上不断移动。

想象一个躺在瓷砖地板上的矩形窗户。如果您将该窗口滑过地板,则看起来就像瓷砖样式在窗口中移动一样。