本文整理汇总了TypeScript中d3-color.hcl函数的典型用法代码示例。如果您正苦于以下问题:TypeScript hcl函数的具体用法?TypeScript hcl怎么用?TypeScript hcl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hcl函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1:
cRGB = cLab.rgb();
displayable = cLab.displayable();
cString = cLab.toString();
cString = cLab.hex();
console.log('Channels = (l : %d, a: %d, b: %d)', cLab.l, cLab.a, cLab.b);
console.log('Opacity = %d', cLab.opacity);
// Signature tests for Gray
cLab = d3Color.gray(120);
cLab = d3Color.gray(120, 0.5);
// Signature tests for HCL
let cHcl: d3Color.HCLColor;
cHcl = d3Color.hcl(120, 40, 50);
cHcl = d3Color.hcl(120, 40, 50, 0.5);
cHcl = d3Color.hcl('steelblue');
cHcl = d3Color.hcl('rgba(20, 100, 200, 0.5)');
cHcl = d3Color.hcl(c);
cHcl = cHcl.brighter();
cHcl = cHcl.brighter(0.2);
cHcl = cHcl.darker();
cHcl = cHcl.darker(0.2);
cRGB = cHcl.rgb();
displayable = cHcl.displayable();
cString = cHcl.toString();
cString = cHcl.hex();
console.log('Channels = (h : %d, c: %d, l: %d)', cHcl.h, cHcl.c, cHcl.l);
console.log('Opacity = %d', cHcl.opacity);
开发者ID:AlexGalays,项目名称:DefinitelyTyped,代码行数:30,代码来源:d3-color-tests.ts
示例2: iZoom
zoom = iZoom(0.5);
console.log('Recommended transition duration = %d', iZoom.duration);
// test quantize(interpolator, n) signature ------------------------------------------------
arrNum = d3Interpolate.quantize(d3Interpolate.interpolateRound(-1, 2), 4); // infered template parameter type
arrStr = d3Interpolate.quantize<string>(d3Interpolate.interpolateString('-1', '2'), 4); // explicit template parameter typing
// arrStr = d3Interpolate.quantize<string>(d3Interpolate.interpolateRound(-1, 2), 4); // test fails, due to explicit typing v argument type mismatch
// test interpolateRgb(a, b) signatures ----------------------------------------------------------------
// without gamma correction
iString = d3Interpolate.interpolateRgb('seagreen', 'steelblue');
iString = d3Interpolate.interpolateRgb(d3Color.rgb('seagreen'), d3Color.hcl('steelblue'));
iString = d3Interpolate.interpolateRgb(d3Color.rgb('seagreen'), d3Hsv.hsv('steelblue'));
str = iString(0.5);
// with gamma correction
iString = d3Interpolate.interpolateRgb.gamma(2.2)('purple', 'orange');
// test interpolateRgbBasis(color) and interpolateRgbBasisClosed(color) signatures -------------------------
iString = d3Interpolate.interpolateRgbBasis(['seagreen', d3Color.rgb('steelblue'), 'rgb(100, 100, 100)']);
iString = d3Interpolate.interpolateRgbBasis(['seagreen', d3Hsv.hsv('steelblue'), 'rgb(100, 100, 100)']);
iString = d3Interpolate.interpolateRgbBasisClosed(['seagreen', d3Hsv.hsv('steelblue'), 'rgb(100, 100, 100)']);
// test interpolateHsl(a, b) and interpolateHslLong(a, b)----------------------------------------------------------------
iString = d3Interpolate.interpolateHsl('seagreen', 'steelblue');
开发者ID:ArtemZag,项目名称:DefinitelyTyped,代码行数:31,代码来源:d3-interpolate-tests.ts
示例3: interpolateHsv
// Method signatures
cHSV = cHSV.brighter();
cHSV = cHSV.brighter(0.2);
cHSV = cHSV.darker();
cHSV = cHSV.darker(0.2);
displayable = cHSV.displayable();
cString = cHSV.toString();
console.log('Channels = (h : %d, s: %d, v: %d)', cHSV.h, cHSV.s, cHSV.v);
console.log('Opacity = %d', cHSV.opacity);
// Interpolater
iString = interpolateHsv('seagreen', 'steelblue');
iString = interpolateHsv(rgb('seagreen'), hcl('steelblue'));
iString = interpolateHsv(rgb('seagreen'), hsv('steelblue'));
iString = interpolateHsvLong('seagreen', 'steelblue');
iString = interpolateHsvLong(rgb('seagreen'), hcl('steelblue'));
iString = interpolateHsvLong(rgb('seagreen'), hsv('steelblue'));
// Prototype, instanceof and typeguard
declare let color: RGBColor | HSVColor | null;
if (color instanceof rgb) {
cRGB = color;
} else if (color instanceof hsv) {
cHSV = color;
} else {
开发者ID:MichaelBuen,项目名称:DefinitelyTyped,代码行数:30,代码来源:d3-hsv-tests.ts
注:本文中的d3-color.hcl函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论