當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。