jCanvas Methods 方法 - caleb531/jcanvas-docs GitHub Wiki
Methods 方法
This is a reference of every jCanvas method, for quick access.
以下是每个jCanvas方法的的参考
If there's no RETURNS information, it'll return jQuery object of the Canvas
如果没写返回值的,就是返回jQuery对象
addLayer(properties) 添加层
返回:jQuery
addLayerToGroup(layerId, groupName) 将层添加到组
返回:jQuery
animateLayer() 层动画
animateLayer( layerId, properties [, duration ] [, easing ] [, callback ] )
animateLayer( layerId, properties, options )
返回:jQuery
animateLayerGroup() 层组动画
animateLayerGroup( groupId, properties [, duration ] [, easing ] [, callback ] )
animateLayerGroup( groupId, properties, options )
返回:jQuery
clearCanvas(properties) 清除画布
返回:jQuery
createGradient(properties) 创建过渡色
Returns: CanvasGradient
返回:画布过渡对象
createPattern(properties) 创建样式
Returns: CanvasPattern
返回:画布样式对象
delayLayer(layerId [, duration ]) 延迟层
返回:jQuery
delayLayerGroup(groupId [, duration ]) 延迟层组
返回:jQuery
detectPixelRatio([ callback ]) 侦测像素比
返回:jQuery
draw(properties) 绘图
返回:jQuery
drawArc(properties) 画圆弧
返回:jQuery
drawBezier(properties) 画贝塞尔曲线
返回:jQuery
drawEllipse(properties) 画椭圆
返回:jQuery
drawImage(properties) 画图像
返回:jQuery
drawLayers() 清空画布并画所有层
返回:jQuery
drawLine(properties) 画线
返回:jQuery
drawPolygon(properties) 画多边形
返回:jQuery
drawQuadratic(properties) 画二次曲线
返回:jQuery
drawRect(properties) 画矩形
返回:jQuery
drawSlice(properties) 画扇形
返回:jQuery
drawText(properties) 画文本
返回:jQuery
drawVector(properties) 画向量
返回:jQuery
getCanvasImage([ imageType ]) 获取画布上的图像
Returns: String
返回:字符串
getEventHooks() 获取事件钩子
Returns: Object
返回:对象
getLayer(layerId) 获取一个层
Returns: Layer
返回:层对象
getLayerGroup(groupId) 获取层组
Returns: Layer
返回:层对象
getLayerIndex(layerId) 获取层索引
Returns: Number
返回:数字
getLayers([ callback ]) 获取所有层
Returns: Array
返回:数组
jCanvas.extend(properties) 扩展
Returns: Function
返回:函数
measureText() 测量文本尺寸
measureText( properties )
measureText( layerId )
Returns: Object
返回:对象
moveLayer(layerId, groupName) 移动层
返回:jQuery
removeLayer(layerId) 删除层
返回:jQuery
removeLayerFromGroup(layerId, groupName) 将层从组中删除
返回:jQuery
removeLayerGroup(groupId) 删除层组
返回:jQuery
removeLayers() 删除所有层
返回:jQuery
restoreCanvas(properties) 恢复画布状态
返回:jQuery
注解:想要获取详情,参考以下文档 rotateCanvas()、scaleCanvas()、translateCanvas()、Masking。
rotateCanvas(properties) 旋转画布
返回:jQuery
saveCanvas(properties) 保存画布状态
这一条新文档中没有了
scaleCanvas(properties) 缩放画布
返回:jQuery
setEventHooks(properties) 设置事件钩子
返回:jQuery
setLayer(layerId, properties) 设置一个层
返回:jQuery
setLayerGroup(groupId, properties) 设置层组
返回:jQuery
setLayers(properties [, callback ]) 设置所有层
返回:jQuery
setPixels(properties) 设置像素点 返回:jQuery
stopLayer(layerId [, clearQueue ]) 停止层
返回:jQuery
stopLayerGroup(groupId [, clearQueue ]) 停止层组
返回:jQuery
translateCanvas(properties) 平移画布
返回:jQuery