diff options
author | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2024-02-13 20:00:02 -0700 |
---|---|---|
committer | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2024-02-13 20:00:02 -0700 |
commit | 0c476e92e1807928ffb30864126076ef4c6a0821 (patch) | |
tree | a4992161ce4b6203edffb5d78533e9c73e61e6f1 /src/scenes/the_lambda_calculus.tsx | |
parent | 512c245466fad78106a046c1ea6233acdcc3e4de (diff) | |
download | compiling-the-lambda-calculus-0c476e92e1807928ffb30864126076ef4c6a0821.tar.gz compiling-the-lambda-calculus-0c476e92e1807928ffb30864126076ef4c6a0821.zip |
Diffstat (limited to 'src/scenes/the_lambda_calculus.tsx')
-rw-r--r-- | src/scenes/the_lambda_calculus.tsx | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/scenes/the_lambda_calculus.tsx b/src/scenes/the_lambda_calculus.tsx new file mode 100644 index 0000000..7a3e692 --- /dev/null +++ b/src/scenes/the_lambda_calculus.tsx @@ -0,0 +1,40 @@ +import { Layout, Txt, makeScene2D } from "@motion-canvas/2d"; +import { + Direction, + beginSlide, + createRef, + slideTransition, +} from "@motion-canvas/core"; +import { theme } from "../theme"; + +const lambdaRules = [ + '1. "x": A variable is a character or string representing a parameter, and is a valid lambda term.', + '2. "(λ x . t)" is an "abstraction" - a function definition, taking as input the \nbound variable x and returning the lambda term t.', + '3. (M N) is an "application", applying a lambda term M with a lambda term N.', +]; + +export default makeScene2D(function* (view) { + const rules = createRef<Txt>(); + + view.add( + <Layout layout direction="column" alignItems="center"> + <Txt fontSize={40} fontFamily={theme.font} fill={theme.text.hex}> + The Lambda Calculus + </Txt> + <Txt + ref={rules} + fontSize={30} + fontFamily={theme.font} + fill={theme.text.hex} + ></Txt> + </Layout> + ); + + yield* slideTransition(Direction.Right); + yield* beginSlide("The Lambda Calculus"); + + for (const rule of lambdaRules) { + yield* rules().text(rules().text() + "\n\n" + rule, 1); + yield* beginSlide("rule - " + rule); + } +}); |