react-native-theme-switch-animation
Version:
A Plug & Play Animations for Switching (Dark/Light) Themes. 🌖
31 lines (30 loc) • 1.03 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.validateCoordinates = exports.calculateRatio = exports.calculateActualRation = void 0;
const validateCoordinates = (value, max, name) => {
if (value === undefined) {
console.warn(`${name} is undefined. Please provide both cx and cy.`);
return false;
}
if (value > max) {
console.warn(`${name} is greater than ${max}. Please provide a ${name} smaller than screen size.`);
return false;
}
if (value < -max) {
console.warn(`${name} is smaller than -${max}. Please provide a ${name} bigger than -screen size.`);
return false;
}
return true;
};
exports.validateCoordinates = validateCoordinates;
const calculateRatio = (value, max) => {
return value >= 0 ? value / max : 1 + value / max;
};
exports.calculateRatio = calculateRatio;
const calculateActualRation = ration => {
return ration > 0 ? ration : 1 + ration;
};
exports.calculateActualRation = calculateActualRation;
//# sourceMappingURL=helpers.js.map