當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript CanvasContext.moveTo方法代碼示例

本文整理匯總了TypeScript中tabris.CanvasContext.moveTo方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript CanvasContext.moveTo方法的具體用法?TypeScript CanvasContext.moveTo怎麽用?TypeScript CanvasContext.moveTo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在tabris.CanvasContext的用法示例。


在下文中一共展示了CanvasContext.moveTo方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: drawHermiteInterpolation

 private drawHermiteInterpolation(ctx: CanvasContext, points: Point[]) {
   ctx.strokeStyle = graphLineColor;
   ctx.lineWidth = graphLineWidth;
   for (let i = 0; i < points.length - 1; i++) {
     ctx.beginPath();
     let [b0, b3] = [points[i], points[i + 1]];
     let h = (b3.x - b0.x) / 3;
     let b1 = { x: b0.x + h, y: b0.y + (h * b0.dydx) };
     let b2 = { x: b3.x - h, y: b3.y - (h * b3.dydx) };
     ctx.moveTo(this.getX(b0.x), this.getY(b0.y));
     ctx.bezierCurveTo(
       this.getX(b1.x), this.getY(b1.y),
       this.getX(b2.x), this.getY(b2.y),
       this.getX(b3.x), this.getY(b3.y)
     );
     ctx.stroke();
   }
 }
開發者ID:Homoola,項目名稱:tabris-js,代碼行數:18,代碼來源:weatherGraph.ts

示例2: drawTemperatureScale

 private drawTemperatureScale(ctx: CanvasContext) {
   let degreeHeight = this.getY(this.scale.minY) - this.getY(this.scale.minY + 1);
   let degreeStep = (degreeHeight > minVerticalDistance) ? 1 : (2 * degreeHeight > minVerticalDistance) ? 2 : 5;
   let minHeight = Math.ceil(this.scale.minY / degreeStep) * degreeStep;
   ctx.strokeStyle = uiLineColor;
   ctx.lineWidth = uiLineWidth;
   for (let height = minHeight; height < this.scale.maxY; height += degreeStep) {
     // horizontal line
     ctx.beginPath();
     ctx.moveTo(this.getX(this.scale.minX), this.getY(height));
     ctx.lineTo(this.getX(this.scale.maxX), this.getY(height));
     ctx.stroke();
     // text label
     ctx.fillStyle = uiTextColor;
     ctx.font = uiFont;
     ctx.textAlign = "right";
     ctx.textBaseline = "middle";
     ctx.fillText(height + "°C", this.getX(this.scale.minX) - 2, this.getY(height));
   }
 }
開發者ID:Homoola,項目名稱:tabris-js,代碼行數:20,代碼來源:weatherGraph.ts

示例3: drawVerticalLine

 private drawVerticalLine(ctx: CanvasContext, time: number, extraLength: number) {
   ctx.beginPath();
   ctx.moveTo(this.getX(time), this.getY(this.scale.minY));
   ctx.lineTo(this.getX(time), this.getY(this.scale.maxY) - extraLength);
   ctx.stroke();
 }
開發者ID:Homoola,項目名稱:tabris-js,代碼行數:6,代碼來源:weatherGraph.ts

示例4:

let voidReturnValue: void;
let imageData: ImageData;
let text: string = '';

voidReturnValue = ctx.arc(num, num, num, num, num, bool);
voidReturnValue = ctx.beginPath();
voidReturnValue = ctx.bezierCurveTo(num, num, num, num, num, num);
voidReturnValue = ctx.clearRect(num, num, num, num);
voidReturnValue = ctx.closePath();
imageData = ctx.createImageData(num, num);
imageData = ctx.createImageData(imageData);
voidReturnValue = ctx.fill();
voidReturnValue = ctx.fillRect(num, num, num, num);
voidReturnValue = ctx.fillText(text, num, num);
imageData = ctx.getImageData(num, num, num, num);
voidReturnValue = ctx.lineTo(num, num);
voidReturnValue = ctx.moveTo(num, num);
voidReturnValue = ctx.putImageData(imageData, num, num);
voidReturnValue = ctx.quadraticCurveTo(num, num, num, num);
voidReturnValue = ctx.rect(num, num, num, num);
voidReturnValue = ctx.restore();
voidReturnValue = ctx.rotate(num);
voidReturnValue = ctx.save();
voidReturnValue = ctx.scale(num, num);
voidReturnValue = ctx.setTransform(num, num, num, num, num, num);
voidReturnValue = ctx.stroke();
voidReturnValue = ctx.strokeRect(num, num, num, num);
voidReturnValue = ctx.strokeText(text, num, num);
voidReturnValue = ctx.transform(num, num, num, num, num, num);
voidReturnValue = ctx.translate(num, num);
開發者ID:eclipsesource,項目名稱:tabris-js,代碼行數:30,代碼來源:CanvasContext.test.ts


注:本文中的tabris.CanvasContext.moveTo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。