Capítulo 48 de 988

Chapter 48: Using randomness

Core Idea

The following thing is an anti-pattern in Remotion:

Key Concepts

  • Fixing the problem
  • False positives
  • Exception: Inside calculateMetadata()
  • See also

Code Examples

const MyComp: React.FC = () => {
  const [randomValues] = useState(() =>
    new Array(10).fill(true).map((a, i) => {
      return {
        x: Math.random(),
        y: Math.random(),
      };
    }),
  );
  // Do something with coordinates
  return <></>;
};
  • What it demonstrates: Usage pattern for Using randomness from the official docs.

Key Takeaways

  1. Understand fixing the problem when working with Using randomness.
  2. Understand false positives when working with Using randomness.
  3. Understand exception: inside calculatemetadata() when working with Using randomness.
  4. Understand see also when working with Using randomness.

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.