您的位置:首页 > Web前端 > JavaScript

Raphael.js API之Raphael.angle(),Raphael.rad(), Paper.customAttributes,Paper.renderfix()

2014-07-07 18:54 489 查看
/*API-108*/

 Raphael.angle(x1, y1, x2, y2, [x3], [y3])

 返回两点或者三点之间的角度,自己绘制箭头会用到

 参数列表:

 x1

    number类型

    第一个点x坐标

y1

    number类型

    第一个点y坐标

x2

    number类型

    第二个点x坐标

y2

    number类型

    第二个点y坐标

...

返回值:number类型角度

/*API-143*/

Raphael.rad(deg)

将角度转为弧度

参数列表:

deg

    number类型

    角度

返回值:弧度

/*API-85*/

 Paper.customAttributes

 一个为多个元素设置属性的自定义方法

示例:

定义方法:

 paper.customAttributes.hue = function (num)

{

    num = num % 1;

    return {fill: "hsb(" + num + ", 0.75, 1)"};

}

使用方法

var c = paper.circle(10, 10, 10).attr({hue: .45});

// or even like this:

c.animate({hue: 1}, 1e3);

paper.customAttributes.hsb = function (h, s, b)

{

    return {fill: "hsb(" + [h, s, b].join(",") + ")"};

};

c.attr({hsb: "0.5 .8 1"});

c.animate({hsb: [1, 0, 0.5]}, 1e3);

/*API-98*/

 Paper.renderfix()

 修复火狐和IE9的半像素问题
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  raphael