import React, { memo } from '../../lib/teact/teact'; import buildClassName from '../../util/buildClassName'; import buildStyle from '../../util/buildStyle'; import styles from './Sparkles.module.scss'; type ButtonParameters = { preset: 'button'; }; type ProgressParameters = { preset: 'progress'; }; type PresetParameters = ButtonParameters | ProgressParameters; type OwnProps = { className?: string; } & PresetParameters; const SYMBOL = '✦'; const ANIMATION_DURATION = 5; // Values are in percents const BUTTON_POSITIONS = [{ x: 20, y: 0, size: 100, durationShift: 10, }, { x: 15, y: 15, size: 75, durationShift: 70, }, { x: 10, y: 35, size: 75, durationShift: 90, }, { x: 20, y: 70, size: 125, durationShift: 30, }, { x: 40, y: 10, size: 125, durationShift: 0, }, { x: 45, y: 60, size: 75, durationShift: 60, }, { x: 60, y: -10, size: 100, durationShift: 20, }, { x: 55, y: 40, size: 75, durationShift: 60, }, { x: 70, y: 65, size: 100, durationShift: 90, }, { x: 80, y: 10, size: 75, durationShift: 30, }, { x: 80, y: 45, size: 125, durationShift: 0, }]; const PROGRESS_POSITIONS = generateRandomProgressPositions(100); const Sparkles = ({ className, ...presetSettings }: OwnProps) => { if (presetSettings.preset === 'button') { return (