UNPKG

@ginden/blinkstick-v2

Version:
19 lines 914 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.assertFpsBelow100 = assertFpsBelow100; const tsafe_1 = require("tsafe"); /** * BlinkStick Nano has an effective frame rate of 70 FPS. * I don't expect that other devices will be able to handle more than 100 FPS (probably less). * This function asserts if the frame rate is below 100 FPS to prevent unexpected behavior for the user. * @param ms * @param steps * @category Animation */ function assertFpsBelow100(ms, steps) { (0, tsafe_1.assert)(steps > 0, `steps must be greater than 0. ms=${ms}, steps=${steps}`); const timePerFrame = ms / steps; (0, tsafe_1.assert)(timePerFrame > 0, `timePerFrame must be greater than 0. ms=${ms}, steps=${steps}`); (0, tsafe_1.assert)(timePerFrame >= 10, `timePerFrame must be at least 10ms. ms=${ms}, steps=${steps}`); } //# sourceMappingURL=assert-fps-below-100.js.map