前端初始化

This commit is contained in:
“hsc”
2026-08-21 15:36:24 +08:00
commit e4d8ecde13
14411 changed files with 2275932 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
/**
* 圆环
*/
import Path, { PathProps } from '../Path';
export class RingShape {
cx = 0
cy = 0
r = 0
r0 = 0
}
export interface RingProps extends PathProps {
shape?: Partial<RingShape>
}
class Ring extends Path<RingProps> {
shape: RingShape
constructor(opts?: RingProps) {
super(opts);
}
getDefaultShape() {
return new RingShape();
}
buildPath(ctx: CanvasRenderingContext2D, shape: RingShape) {
const x = shape.cx;
const y = shape.cy;
const PI2 = Math.PI * 2;
ctx.moveTo(x + shape.r, y);
ctx.arc(x, y, shape.r, 0, PI2, false);
ctx.moveTo(x + shape.r0, y);
ctx.arc(x, y, shape.r0, 0, PI2, true);
}
}
Ring.prototype.type = 'ring';
export default Ring;