本文整理汇总了TypeScript中external/gs_tools/src/immutable.Vector2d类的典型用法代码示例。如果您正苦于以下问题:TypeScript Vector2d类的具体用法?TypeScript Vector2d怎么用?TypeScript Vector2d使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Vector2d类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it(`should return the correct animations`, () => {
const clientRect = {height: 12, left: 34, top: 56, width: 78} as ClientRect;
const circleCenter = Vector2d.of(9, 10);
const animations = switchEl['computeAnimations_'](clientRect, circleCenter);
const relativeCenterX = -25;
const relativeCenterY = -46;
const minLength = Math.sqrt(25 * 25 + 46 * 46);
const maxLength = Math.sqrt(103 * 103 + 58 * 58);
assert(animations.container['keyframes_']).to.equal([
{
height: `${2 * minLength}px`,
left: `${relativeCenterX - minLength}px`,
top: `${relativeCenterY - minLength}px`,
width: `${2 * minLength}px`,
},
{
height: `${2 * maxLength}px`,
left: `${relativeCenterX - maxLength}px`,
top: `${relativeCenterY - maxLength}px`,
width: `${2 * maxLength}px`,
},
]);
assert(animations.slot['keyframes_']).to.equal([
{
left: `${minLength - relativeCenterX}px`,
top: `${minLength - relativeCenterY}px`,
},
{
left: `${maxLength - relativeCenterX}px`,
top: `${maxLength - relativeCenterY}px`,
},
]);
});