Usage

Share animation targets between views.

tsx
// Share animation targets between views.
import { Pressable, Text, signal, spring, timing, type AnimatedProps } from 'kuito';

const selected = signal(false);

const look = (on: boolean): AnimatedProps => ({
  opacity: on ? 1 : 0.6,
  scale: on ? 1 : 0.96,
  backgroundColor: on ? '#0a84ff' : '#e5e5ea',
});

<Pressable
  animate={look(selected.value)}
  transition={{
    opacity: timing(200),
    transform: spring({ damping: 14 }),
    backgroundColor: timing(200),
  }}
  onPress={() => (selected.value = !selected.value)}
>
  <Text>Follow</Text>
</Pressable>;

Type declaration

ts
export type AnimatedProps = Partial<Record<AnimatableProps, number | string>>;

Members 16

NameTypeRequiredDescription
opacitystring | numberNo—
backgroundColorstring | numberNo—
borderRadiusstring | numberNo—
borderColorstring | numberNo—
widthstring | numberNo—
heightstring | numberNo—
translateXstring | numberNo—
translateYstring | numberNo—
scalestring | numberNo—
scaleXstring | numberNo—
scaleYstring | numberNo—
rotatestring | numberNo—
shadowColorstring | numberNo—
shadowRadiusstring | numberNo—
shadowOffsetXstring | numberNo—
shadowOffsetYstring | numberNo—
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.