本文整理汇总了TypeScript中d3-path.path函数的典型用法代码示例。如果您正苦于以下问题:TypeScript path函数的具体用法?TypeScript path怎么用?TypeScript path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了path函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: swapXY
return d => {
const srcNode = d.source
const tgtNode = d.target
const src = swapXY(cR(srcNode))
const tgt = swapXY(cL(tgtNode))
const path = d3Path.path()
path.moveTo(src.x, src.y)
const midX = Math.floor((src.x + tgt.x) / 2)
// const midY = Math.floor((src.y + tgt.y) / 2)
path.bezierCurveTo(midX, src.y, midX, tgt.y, tgt.x, tgt.y)
return path.toString()
}
开发者ID:Ptival,项目名称:PeaCoq,代码行数:12,代码来源:utils.ts
示例2: lineOnlyFactory
areaRadialLineGenerator = radialArea.lineStartAngle();
areaRadialLineGenerator = radialArea.lineInnerRadius();
areaRadialLineGenerator = radialArea.lineEndAngle();
areaRadialLineGenerator = radialArea.lineOuterRadius();
// -----------------------------------------------------------------------------------
// Test Curve Factories
// -----------------------------------------------------------------------------------
// Test General interfaces -----------------------------------------------------------
let lineOnlyGenerator: d3Shape.CurveGeneratorLineOnly;
const lineOnlyFactory: d3Shape.CurveFactoryLineOnly = d3Shape.curveBundle;
lineOnlyGenerator = lineOnlyFactory(path());
lineOnlyGenerator = lineOnlyFactory(context!); // force context to be non-null with post-fix for mock
lineOnlyGenerator.lineStart();
lineOnlyGenerator.lineEnd();
lineOnlyGenerator.point(10, 20);
let curveGenerator: d3Shape.CurveGenerator;
let curveFactory: d3Shape.CurveFactory = d3Shape.curveBasis;
curveGenerator = curveFactory(path());
curveGenerator = curveFactory(context!); // force context to be non-null with post-fix for mock
curveGenerator.lineStart();
curveGenerator.lineEnd();
开发者ID:Georadix,项目名称:DefinitelyTyped,代码行数:31,代码来源:d3-shape-tests.ts
示例3:
/**
* Typescript definition tests for d3/d3-path module
*
* Note: These tests are intended to test the definitions only
* in the sense of typing and call signature consistency. They
* are not intended as functional tests.
*/
import * as d3Path from 'd3-path';
// -----------------------------------------------------------------------------------------
// Test create new path serializer
// -----------------------------------------------------------------------------------------
const context: d3Path.Path = d3Path.path();
// -----------------------------------------------------------------------------------------
// Test path serializer methods
// -----------------------------------------------------------------------------------------
context.moveTo(50, 50);
context.lineTo(100, 100);
context.quadraticCurveTo(150, 200, 200, 100);
context.bezierCurveTo(300, 50, 400, 200, 500, 100);
context.arcTo(250, 250, 300, 300, 60);
context.arc(400, 400, 50, 0, Math.PI / 2);
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:31,代码来源:d3-path-tests.ts
注:本文中的d3-path.path函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论