@visactor/vgrammar-core
Version:
VGrammar is a visual grammar library
33 lines (30 loc) • 1.53 kB
JavaScript
import { isNumberClose, isValidNumber } from "@visactor/vutils";
export const rotateIn = (element, options, animationParameters) => {
var _a;
const attributeAngle = null !== (_a = element.getFinalAnimationAttribute("angle")) && void 0 !== _a ? _a : 0;
let angle = 0;
return angle = isNumberClose(attributeAngle / (2 * Math.PI), 0) ? Math.round(attributeAngle / (2 * Math.PI)) * Math.PI * 2 : isValidNumber(null == options ? void 0 : options.angle) ? options.angle : "anticlockwise" === (null == options ? void 0 : options.orient) ? Math.ceil(attributeAngle / (2 * Math.PI)) * Math.PI * 2 : Math.floor(attributeAngle / (2 * Math.PI)) * Math.PI * 2,
{
from: {
angle: angle
},
to: {
angle: attributeAngle
}
};
};
export const rotateOut = (element, options, animationParameters) => {
var _a;
const finalAngle = null !== (_a = element.getGraphicAttribute("angle", !0)) && void 0 !== _a ? _a : 0;
let angle = 0;
return angle = isNumberClose(finalAngle / (2 * Math.PI), 0) ? Math.round(finalAngle / (2 * Math.PI)) * Math.PI * 2 : isValidNumber(null == options ? void 0 : options.angle) ? options.angle : "anticlockwise" === (null == options ? void 0 : options.orient) ? Math.ceil(finalAngle / (2 * Math.PI)) * Math.PI * 2 : Math.floor(finalAngle / (2 * Math.PI)) * Math.PI * 2,
{
from: {
angle: finalAngle
},
to: {
angle: angle
}
};
};
//# sourceMappingURL=rotate.js.map