本文整理汇总了TypeScript中core/util/canvas.Context2d.lineTo方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Context2d.lineTo方法的具体用法?TypeScript Context2d.lineTo怎么用?TypeScript Context2d.lineTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core/util/canvas.Context2d
的用法示例。
在下文中一共展示了Context2d.lineTo方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
const _one_diamond = function(ctx: Context2d, r) {
ctx.moveTo(0, r);
ctx.lineTo(r/1.5, 0);
ctx.lineTo(0, -r);
ctx.lineTo(-r/1.5, 0);
return ctx.closePath();
};
示例2: _normal
_normal(ctx: Context2d, _i: number): void {
ctx.beginPath()
ctx.moveTo(0.5*this.size, this.size)
ctx.lineTo(0, 0)
ctx.lineTo(-0.5*this.size, this.size)
ctx.closePath()
}
示例3: _one_diamond
function _one_diamond(ctx: Context2d, r: number): void {
ctx.moveTo(0, r)
ctx.lineTo(r/1.5, 0)
ctx.lineTo(0, -r)
ctx.lineTo(-r/1.5, 0)
ctx.closePath()
}
示例4: clip
clip(ctx: Context2d, i: number): void {
// This method should not begin or close a path
this.visuals.line.set_vectorize(ctx, i)
ctx.moveTo(0.5*this.size, this.size)
ctx.lineTo(0.5*this.size, -2)
ctx.lineTo(-0.5*this.size, -2)
ctx.lineTo(-0.5*this.size, this.size)
ctx.lineTo(0.5*this.size, this.size)
}
示例5: _one_tri
function _one_tri(ctx: Context2d, r: number): void {
const h = r*SQ3
const a = h/3
ctx.moveTo(-r, a)
ctx.lineTo(r, a)
ctx.lineTo(0, a-h)
ctx.closePath()
}
示例6: render
render(ctx: Context2d, i: number): void {
if (this.visuals.line.doit) {
this.visuals.line.set_vectorize(ctx, i)
ctx.beginPath()
ctx.moveTo(0.5*this.size, this.size)
ctx.lineTo(0, 0)
ctx.lineTo(-0.5*this.size, this.size)
ctx.stroke()
}
}
示例7: _render
_render(ctx: Context2d, indices, {sxs, sys}) {
// @sxss and @syss are used by _hit_point and sxc, syc
// This is the earliest we can build them, and only build them once
this.renderer.sxss = this._build_discontinuous_object(sxs);
this.renderer.syss = this._build_discontinuous_object(sys);
for (const i of indices) {
const [sx, sy] = [sxs[i], sys[i]];
if (this.visuals.fill.doit) {
this.visuals.fill.set_vectorize(ctx, i);
for (let j = 0, end = sx.length; j < end; j++) {
if (j === 0) {
ctx.beginPath();
ctx.moveTo(sx[j], sy[j]);
continue;
} else if (isNaN(sx[j] + sy[j])) {
ctx.closePath();
ctx.fill();
ctx.beginPath();
continue;
} else {
ctx.lineTo(sx[j], sy[j]);
}
}
ctx.closePath();
ctx.fill();
}
if (this.visuals.line.doit) {
this.visuals.line.set_vectorize(ctx, i);
for (let j = 0, end = sx.length; j < end; j++) {
if (j === 0) {
ctx.beginPath();
ctx.moveTo(sx[j], sy[j]);
continue;
} else if (isNaN(sx[j] + sy[j])) {
ctx.closePath();
ctx.stroke();
ctx.beginPath();
continue;
} else {
ctx.lineTo(sx[j], sy[j]);
}
}
ctx.closePath();
ctx.stroke();
}
}
}
示例8: _inner
protected _inner(ctx: Context2d, sx1: Arrayable<number>, sx2: Arrayable<number>, sy: Arrayable<number>, func: (this: Context2d) => void): void {
ctx.beginPath()
for (let i = 0, end = sx1.length; i < end; i++) {
ctx.lineTo(sx1[i], sy[i])
}
// iterate backwards so that the upper end is below the lower start
for (let start = sx2.length-1, i = start; i >= 0; i--) {
ctx.lineTo(sx2[i], sy[i])
}
ctx.closePath()
func.call(ctx)
}
示例9: _one_hex
function _one_hex(ctx: Context2d, r: number): void {
const r2 = r/2
const h = SQ3*r2
ctx.moveTo( r, 0)
ctx.lineTo( r2, -h)
ctx.lineTo(-r2, -h)
ctx.lineTo(-r, 0)
ctx.lineTo(-r2, h)
ctx.lineTo( r2, h)
ctx.closePath()
}