framer-motion
Version:
An open source and production-ready motion library for React on the web
39 lines (38 loc) • 1.13 kB
TypeScript
import { MotionValue } from "./";
interface ScaleMotionValues {
scaleX: MotionValue<number>;
scaleY: MotionValue<number>;
}
export declare const invertScale: (scale: number) => number;
/**
* Returns a `MotionValue` each for `scaleX` and `scaleY` that update with the inverse
* of their respective parent scales.
*
* This is useful for undoing the distortion of content when scaling a parent component.
*
* By default, `useInvertedScale` will automatically fetch `scaleX` and `scaleY` from the nearest parent.
* By passing other `MotionValue`s in as `useInvertedScale({ scaleX, scaleY })`, it will invert the output
* of those instead.
*
* @motion
*
* ```jsx
* const MyComponent = () => {
* const { scaleX, scaleY } = useInvertedScale()
* return <motion.div style={{ scaleX, scaleY }} />
* }
* ```
*
* @library
*
* ```jsx
* function MyComponent() {
* const { scaleX, scaleY } = useInvertedScale()
* return <Frame scaleX={scaleX} scaleY={scaleY} />
* }
* ```
*
* @deprecated
*/
export declare function useInvertedScale(scale?: Partial<ScaleMotionValues>): ScaleMotionValues;
export {};