diff options
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()); + } +}); |