Raphael 中文API

一、动画

1、Animation.delay(delay) ➭

创建现有的动画对象的副本,并指定延迟时间。

参数

delay

Number

动画开始和实际动画之间的毫秒数

返回

Object

新的动画对象

 

示例

var anim = Raphael.animation({cx: 10, cy: 20}, 2e3);
circle1.animate(anim); // run the given animation immediately
circle2.animate(anim.delay(500)); // run the given animation after 500 ms

2、Animation.repeat(repeat) ➭

创建现有动画对象的副本,并指定重复频率。

参数

delay

Number

动画迭代次数。0 为无限

返回

Object

新的动画对象

 

二、元素

1、Element.animate(…) ➭

为指定元素创建动画,并播放。

参数

params

Object

元素的最终属性,见Element.attr

ms

Number

动画持续时间(毫秒)

easing

String

曲线类型。接受Raphael.easing_formulas 其中之一或

CSS格式:cubic-bezier(XX, XX, XX, XX)

callback

Function

回调函数。动画结束时将被调用。

 

 

animation

Object

动画对象,见Raphael.animation

返回

Object

原始元素

 

2、Element.animateWith(…) ➭

作用与Element.animate 类似,但保证动画与另一元素的同步播放。

参数

el

Object

要同步的元素

anim

Object

要同步的动画

params

Object

元素的最终属性,见Element.attr

ms

Number

动画持续时间(毫秒)

easing

String

曲线类型。接受Raphael.easing_formulas 或CSS

格式:cubic‐bezier(XX, XX, XX, XX)

callback

Function

回调函数。动画结束时将被调用。

 

 

element

Object

要同步的元素

anim

Object

要同步的动画

animation

Object

动画对象,见Raphael.animation

返回

Object

原始元素

 

3、Element.attr(…) ➭

设置元素的属性。

参数

attrName

String

属性值

value

String

属性值

params

Object

对象/值对

attrName

String

属性的名称

 

 

attrNames

Array

在这种情况下,方法返回指定属性名的当前值组成的数组

anim

对象

要同步的动画

animation

对象

动画对象,见Raphael.animation

返回

对象

原始元素

 
可能的参数
请参阅解释这些参数的SVG 规范
 
---
posted @ 2017-09-15 15:50  FanLi丶  阅读(233)  评论(0)    收藏  举报