diff options
author | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2024-02-07 11:06:03 -0700 |
---|---|---|
committer | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2024-02-07 11:06:03 -0700 |
commit | 6a3ce850c5bb28875d424230998e811a699df37d (patch) | |
tree | eb6cd556e06864d722f7a3415c96bced8c89a66b /src/scenes/doctor.tsx | |
parent | 1e53c846e40bb7a8eb733542b2cb9fcd0ca996a8 (diff) | |
download | compiling-the-lambda-calculus-6a3ce850c5bb28875d424230998e811a699df37d.tar.gz compiling-the-lambda-calculus-6a3ce850c5bb28875d424230998e811a699df37d.zip |
more
Diffstat (limited to 'src/scenes/doctor.tsx')
-rw-r--r-- | src/scenes/doctor.tsx | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/scenes/doctor.tsx b/src/scenes/doctor.tsx new file mode 100644 index 0000000..642b83e --- /dev/null +++ b/src/scenes/doctor.tsx @@ -0,0 +1,55 @@ +import { Txt, makeScene2D } from "@motion-canvas/2d"; +import { + Direction, + beginSlide, + createRef, + slideTransition, + waitFor, +} from "@motion-canvas/core"; +import { CodeBlock, insert } from "@motion-canvas/2d/lib/components/CodeBlock"; +import { theme } from "../theme"; + +const conversation = ` +I am the psychotherapist. Please, describe your problems. Each time you are finished talking, type RET twice. +> i need a valentine +Why do you say you might want to have this valentine? +> im lonely +Are you lonely often? +> sometimes +Can you elaborate on that? +> i need someone or something i can trust +What makes you believe you need someone or something you can trust? +> i want something that when i ask one question i'll get the same answer no matter what. +Is it because when you ask one question you will get the same answerno matter what that you came to me? +> yes +I see... Well, are you sure that this is so? +> yes +Yes, hmmm... so, do you really think this is so? +> yes` + .split("\n") + .filter((x) => x.trim()); + +export default makeScene2D(function* (view) { + const block = createRef<CodeBlock>(); + + yield view.add( + <CodeBlock + fontFamily={theme.font} + language="markdown" + ref={block} + fontSize={20} + ></CodeBlock>, + ); + + yield* slideTransition(Direction.Right); + + let currentConversation = conversation[0] + "\n"; + let id = 0; + for (const line of conversation.slice(1)) { + yield* block().edit(1.2, false)`${currentConversation}${insert( + "\n" + line + "\n", + )}`; + currentConversation += "\n" + line + "\n"; + yield* beginSlide(line.split(" ").slice(0, 3).join(" ") + id.toString()); + } +}); |