Capítulo 12 de 988

Chapter 12: interpolate()

Core Idea

<YouTube minutes={6} href="https://www. youtube.

Key Concepts

  • Example: Fade-in effect
  • Example: Fade in and out
  • Example: interpolate a spring animation
  • Example: Prevent the output from going outside the output range
  • Example: Scaling feels nonlinear? Use perceptual scale output<AvailableFrom v="4.0.490" />
  • Example: CSS transform values<AvailableFrom v="4.0.472" />
  • Example: Discrete string values<AvailableFrom v="4.0.509" />
  • Example: Numeric tuples<AvailableFrom v="4.0.473" />

Code Examples

const frame = useCurrentFrame(); // 10
const opacity = interpolate(frame, [0, 20], [0, 1]); // 0.5
  • What it demonstrates: Usage pattern for interpolate() from the official docs.

Key Takeaways

  1. Understand example: fade-in effect when working with interpolate().
  2. Understand example: fade in and out when working with interpolate().
  3. Understand example: interpolate a spring animation when working with interpolate().
  4. Understand example: prevent the output from going outside the output range when working with interpolate().
  5. Understand example: scaling feels nonlinear? use perceptual scale output<availablefrom v="4.0.490" /> when working with interpolate().

Connects To

  • Absolute Fill: related page in the Fundamentals & Core Concepts section.
  • Animating Properties: related page in the Fundamentals & Core Concepts section.
  • Animation Math: related page in the Fundamentals & Core Concepts section.