当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript d3-interpolate.interpolateString函数代码示例

本文整理汇总了TypeScript中d3-interpolate.interpolateString函数的典型用法代码示例。如果您正苦于以下问题:TypeScript interpolateString函数的具体用法?TypeScript interpolateString怎么用?TypeScript interpolateString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了interpolateString函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: function

enterTransition = enterTransition.attrTween('r', function (d, i, g) {
    let that: SVGCircleElement = this;
    // let that2: HTMLElement  = this; // fails, type mismatch
    let datum: CircleDatum = d;
    let index: number = i;
    let group: SVGCircleElement[] | ArrayLike<SVGCircleElement> = g;
    console.log(this.r.baseVal.value); // this type is SVGCircleElement
    return interpolateString(0, d.r); // datum type is CircleDatum
});
开发者ID:ArtemZag,项目名称:DefinitelyTyped,代码行数:9,代码来源:d3-transition-tests.ts

示例2: NumCoercible

// test interpolateNumber(a, b) signature ----------------------------------------------------

iNum = d3Interpolate.interpolateNumber(0, 100);
iNum = d3Interpolate.interpolateNumber(new NumCoercible(0), new NumCoercible(100));
num = iNum(0.5);

// test interpolateNumber(a, b) signature ----------------------------------------------------

iNum = d3Interpolate.interpolateRound(0, 100);
iNum = d3Interpolate.interpolateRound(new NumCoercible(0), new NumCoercible(100));
num = iNum(0.5);

// test interpolateString(a, b) signature ----------------------------------------------------

iString = d3Interpolate.interpolateString('-1', '2');
str = iString(0.5);

// test interpolateDate(a, b) signature ----------------------------------------------------

iDate = d3Interpolate.interpolateDate(new Date(2016, 6, 1), new Date(2016, 6, 31));

// test interpolateArray(a, b) signature ----------------------------------------------------

iArrayNum = d3Interpolate.interpolateArray<Array<number>>([1, 2], [4, 8]); // explicit typing
arrNum = iArrayNum(0.5);

iArrayNum = d3Interpolate.interpolateArray<[number, number]>(['1', '2'], [4, 8]); // explicit typing
arrNum = iArrayNum(0.5);

iArrayStr = d3Interpolate.interpolateArray<Array<string>>(['1', '2'], ['4', '8']); // explicit typing
开发者ID:ArtemZag,项目名称:DefinitelyTyped,代码行数:30,代码来源:d3-interpolate-tests.ts

示例3: function

enterTransition = enterTransition.attrTween('r', function (d, i, group) {
    console.log(this.r.baseVal.value); // this type is SVGCircleElement
    return interpolateString(0, d.r); // datum type is CircleDatum
});
开发者ID:rchaser53,项目名称:DefinitelyTyped,代码行数:4,代码来源:d3-transition-tests.ts


注:本文中的d3-interpolate.interpolateString函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。