UNPKG

react-native-fiesta

Version:

A set of celebration animations powered by Skia. Engage more with your users by celebrating in your React Native application.

44 lines (40 loc) 1.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.fromRadians = fromRadians; exports.generateRandomCoordinates = generateRandomCoordinates; var _dimensions = require("../constants/dimensions"); function fromRadians(angle) { return angle * (180.0 / Math.PI); } function generateRandomCoordinates(numElements, specificHeight, specificWidth) { // Create an array to store the generated coordinates const coordinates = []; // Generate random x,y coordinates until we have the desired number of elements while (coordinates.length < numElements) { // Generate a random x,y coordinate const x = Math.random() * (specificWidth ?? _dimensions.screenWidth); const y = Math.random() * (specificHeight ?? _dimensions.screenHeight); // Check if the coordinate is unique let unique = true; for (const { x: prevX, y: prevY } of coordinates) { if (prevX === x && prevY === y) { unique = false; break; } } // If the coordinate is unique, add it to the array of coordinates if (unique) { coordinates.push({ x, y }); } } return coordinates; } //# sourceMappingURL=fireworks.js.map