All files / src/react-parallax-tilt types.public.ts

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74                                                                                                                                                   
import { GlareProps } from 'features/glare/types.public';
import { TiltProps } from 'features/tilt/types.public';
 
export type OnMoveParams = {
  tiltAngleX: number;
  tiltAngleY: number;
  tiltAngleXPercentage: number;
  tiltAngleYPercentage: number;
  glareAngle: number;
  glareOpacity: number;
  eventType: string;
};
 
type OnMove = (onMoveParams: OnMoveParams) => void;
 
type HtmlDivTilt = Pick<React.HTMLAttributes<HTMLDivElement>, 'className' | 'style'>;
 
export type ReactParallaxTiltProps = TiltProps &
  GlareProps &
  HtmlDivTilt & {
    /**
     * Tilt children component
     */
    children?: React.ReactNode;
    /**
     * Scale of the component (1.5 = 150%, 2 = 200%, etc.).
     */
    scale?: number;
    /**
     * The perspective property defines how far the object (wrapped/child component) is away from the user. The lower the more extreme the tilt gets.
     */
    perspective?: number;
    /**
     * Boolean to enable/disable vertical flip of component.
     */
    flipVertically?: boolean;
    /**
     * Boolean to enable/disable horizontal flip of component.
     */
    flipHorizontally?: boolean;
    /**
     * If the effects has to be reset on "onLeave" event.
     */
    reset?: boolean;
    /**
     * Easing of the transition when manipulating the component.
     */
    transitionEasing?: string;
    /**
     * Speed of the transition when manipulating the component.
     */
    transitionSpeed?: number;
    /**
     * Track mouse and touch events on the whole window.
     */
    trackOnWindow?: boolean;
    /**
     * Boolean to enable/disable device orientation detection.
     */
    gyroscope?: boolean;
    /**
     * Gets triggered when user moves on the component.
     */
    onMove?: OnMove;
    /**
     * Gets triggered when user enters the component.
     */
    onEnter?: (eventType: string) => void;
    /**
     * Gets triggered when user leaves the component.
     */
    onLeave?: (eventType: string) => void;
  };