Class: EllipseShape
椭圆形状
Hierarchy
↳
EllipseShape
Table of contents
Constructors
Properties
- className
- dirty
- isClosed
- points
- Arc
- Arrow
- ArrowShape
- BezierCurve
- Circle
- Curve
- Damond
- Ellipse
- Line
- Polygon
- Rect
- RectShape
- Triangle
- tip
Methods
- clone
- draw
- rotate
- scale
- skew
- toJSON
- updatePoints
- Scale
- circlePoints
- fn
- fromJSON
- fromPoints
- innerGrid
- normalPoints
- outerGrid
- parallelogram
- pointToSize
- polygon
Constructors
constructor
new EllipseShape(unitPoints?
)
Parameters
Name | Type |
---|---|
unitPoints | { x : number = 0; y : number = 0 }[] |
Overrides
Properties
className
className: string
Overrides
dirty
dirty: boolean
Inherited from
isClosed
isClosed: boolean
= true
是否封闭图形(最后一个点是否连接到第一个点形成封闭图形),默认true
Inherited from
points
points: PointLike
[]
单位点列表 x:[-0.5, 0.5] y: [-0.5, 0.5]
Inherited from
Arc
Static
Arc: any
一个全局的Arc实例对象
Inherited from
Arrow
Static
Arrow: any
一个全局的箭头形状实例对象
Inherited from
ArrowShape
Static
ArrowShape: any
已过时,不推荐使用,未来将移除
请使用 Shape.Arrow 来替代: Shape.ArrowShape
Deprecated
Inherited from
BezierCurve
Static
BezierCurve: any
一个全局的贝塞尔实例对象
Inherited from
Circle
Static
Circle: any
一个全局的圆形实例对象
Inherited from
Curve
Static
Curve: any
一个全局的曲线实例对象
Inherited from
Damond
Static
Damond: Shape
菱形
Inherited from
Ellipse
Static
Ellipse: any
一个全局的椭圆实例对象
Inherited from
Line
Static
Line: any
一个全局的线条实例对象
Inherited from
Polygon
Static
Polygon: any
生成多边形对象
已过时,不推荐使用,未来将移除
请使用 Shape.polygon (p小写) 来替代:Shape.Polygon
Deprecated
Inherited from
Rect
Static
Rect: any
一个全局的矩形实例对象
Inherited from
RectShape
Static
RectShape: any
已过时,不推荐使用,未来将移除
请使用 Shape.Rect 来替代: Shape.RectShape
Deprecated
Inherited from
Triangle
Static
Triangle: Shape
一个全局的三角型, 右朝向
Inherited from
tip
Static
tip: Shape
Inherited from
Methods
clone
clone(): Shape
Returns
Inherited from
draw
draw(ctx
, points
, object
): void
Parameters
Name | Type |
---|---|
ctx | CanvasRenderingContext2D |
points | PointLike [] |
object | DisplayObject |
Returns
void
Overrides
rotate
rotate(angle
): EllipseShape
旋转,会修改points属性
Parameters
Name | Type |
---|---|
angle | number |
Returns
Inherited from
scale
scale(sx
, sy
): EllipseShape
缩放,会修改points属性
Parameters
Name | Type |
---|---|
sx | number |
sy | number |
Returns
Inherited from
skew
skew(sx
, sy
): EllipseShape
Parameters
Name | Type |
---|---|
sx | number |
sy | number |
Returns
Inherited from
toJSON
toJSON(): any
Returns
any
Inherited from
updatePoints
updatePoints(unitPoints
): void
更新数据点
Parameters
Name | Type | Description |
---|---|---|
unitPoints | PointLike [] | 单位点列表 x:[-0.5, 0.5] y: [-0.5, 0.5] |
Returns
void
Inherited from
Scale
Static
Scale(sx
, sy
): (p
: PointLike
) => PointLike
Deprecated
Parameters
Name | Type |
---|---|
sx | number |
sy | number |
Returns
fn
(p
): PointLike
Parameters
Name | Type |
---|---|
p | PointLike |
Returns
Inherited from
circlePoints
Static
circlePoints(opt
): any
[]
生成圆上一列的点
Parameters
Name | Type |
---|---|
opt | Object |
opt.begin | number |
opt.end | number |
opt.pointCount? | number |
opt.step | number |
Returns
any
[]
Inherited from
fn
Static
fn(f
): Shape
自定义函数来构
Parameters
Name | Type |
---|---|
f | Function |
Returns
Inherited from
fromJSON
Static
fromJSON(json
): any
Parameters
Name | Type |
---|---|
json | any |
Returns
any
Inherited from
fromPoints
Static
fromPoints(points
, keepAspectRatio?
): Shape
Parameters
Name | Type | Default value |
---|---|---|
points | PointLike [] | undefined |
keepAspectRatio | boolean | true |
Returns
Inherited from
innerGrid
Static
innerGrid(rows
, cols
): Shape
生成内网格坐标
Parameters
Name | Type | Description |
---|---|---|
rows | number | 行 |
cols | number | 列 |
Returns
Inherited from
normalPoints
Static
normalPoints(points
, keepAspectRatio?
): { x
: number
; y
: number
}[]
将指定点坐标单位化
Parameters
Name | Type | Default value |
---|---|---|
points | PointLike [] | undefined |
keepAspectRatio | boolean | true |
Returns
{ x
: number
; y
: number
}[]
Inherited from
outerGrid
Static
outerGrid(rows
, cols
): Shape
生成网格坐标(外边框)
Parameters
Name | Type | Description |
---|---|---|
rows | number | 行 |
cols | number | 列 |
Returns
一维数组(单位坐标)
Inherited from
parallelogram
Static
parallelogram(beginX?
): Shape
生成一个平行四边形实例(上面一条边向右倾斜)
Parameters
Name | Type | Default value | Description |
---|---|---|---|
beginX | number | 0.2 | X偏移百分比 |
Returns
Inherited from
pointToSize
Static
pointToSize(points
, width
, height
, keepAspectRatio?
): { x
: number
; y
: number
}[]
Parameters
Name | Type | Default value |
---|---|---|
points | PointLike [] | undefined |
width | number | undefined |
height | number | undefined |
keepAspectRatio | boolean | false |
Returns
{ x
: number
; y
: number
}[]
Inherited from
polygon
Static
polygon(edgeCount?
, initAngle?
): Shape
生成多边形Shape对象
Parameters
Name | Type | Default value | Description |
---|---|---|---|
edgeCount | number | 3 | 边的条数 |
initAngle | number | 0 | 初始角度 |