Utilisation

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>;

Déclaration du type

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

Membres 16

NomTypeRequisDescription
opacitystring | numberNon—
backgroundColorstring | numberNon—
borderRadiusstring | numberNon—
borderColorstring | numberNon—
widthstring | numberNon—
heightstring | numberNon—
translateXstring | numberNon—
translateYstring | numberNon—
scalestring | numberNon—
scaleXstring | numberNon—
scaleYstring | numberNon—
rotatestring | numberNon—
shadowColorstring | numberNon—
shadowRadiusstring | numberNon—
shadowOffsetXstring | numberNon—
shadowOffsetYstring | numberNon—
Généré depuis les déclarations TypeScript publiques : signatures, props et valeurs par défaut viennent de la source vérifiée, les descriptions de sa JSDoc. Aucune valeur par défaut n'est inventée.