summaryrefslogtreecommitdiff
path: root/src/scenes/recursion.tsx
blob: 167dd00bcd240d32969098e6aa49938010fab17d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { Layout, Txt, makeScene2D } from "@motion-canvas/2d";
import {
  Direction,
  beginSlide,
  createRef,
  slideTransition,
} from "@motion-canvas/core";
import { theme } from "../theme";

const recursion = ["Y = λ f . (λ x . f (x x)) (λ x . f (x x))"];

export default makeScene2D(function* (view) {
  const lines = createRef<Txt>();

  view.add(
    <Layout layout direction="column" alignItems="center">
      <Txt fontSize={40} fontFamily={theme.font} fill={theme.text.hex}>
        Recursion and Combinators
      </Txt>
      <Txt
        ref={lines}
        fontSize={30}
        fontFamily={theme.font}
        fill={theme.text.hex}
      ></Txt>
    </Layout>
  );

  yield* slideTransition(Direction.Right);
  yield* beginSlide("The Lambda Calculus - Church Encoding");

  for (const line of recursion) {
    yield* lines().text(lines().text() + "\n\n" + line, 1);
    yield* beginSlide("recursion - " + line);
  }
});