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.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.js API之Element.id,Element.insertAfter(),Element.insertBefore(),Element.hide(),Paper.clear(),
- Raphael.js API 之Element.remove(),Element.removeData(),paper.text(),Element.node(),Element.onDragOver
- Raphael.js API 之Element.unclick(),Paper.add(),Paper.rect(),Element.status()
- Raphael.js API之 Element.raphael,Paper.raphael,Paper.print()
- Raphael.js API之Raphael.getPointAtLength(),Paper.forEach(),Paper.remove(),Paper.set(),Paper.setStart(
- Raphael.js API 之Element.remove(),Element.removeData(),paper.text(),Element.node(),Element.onDragOver
- Raphael.js API之 Paper.path(),Element.click()
- Raphael.js API之Paper.image(),Element.animate()
- Raphael.js API之Raphael.svg(),Element.paper,Element.pause(),Raphael.pathBBox(),Raphael.st,Raphael.el
- Raphael.js API之 Animation.delay(),Animation.repeat(),Element.animateWith()
- Raphaël Raphael.js 中文帮助文档,SVG、VML、Javascript矢量库(Raphael Reference API)
- Raphael.js API 之 Element.attr()
- Raphael.js API之 Raphael.getTotalLength(),Raphael.fn
- LINK - Paging for Azure Mobile Service Custom API (JS)
- Raphael.js API之Element.drag(),Element.toBack()
- Raphael.js API之Element.clone(),Element.data(),Element.dblclick()
- Raphael学习之Paper常用API(四)
- Raphael.js API之Element.mousedown(),Element.mousemove(),Element.mouseup(),Element.mouseout(),Element.
- JSSoundKit: 超简单的网页播放器API
- JSSoundKit: 超简单的网页播放器API