summaryrefslogtreecommitdiff
path: root/src/scenes/doctor.tsx
blob: 4b6c48394456583fa240709d36e45b04236e2b1a (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import { makeScene2D } from "@motion-canvas/2d";
import {
  Direction,
  beginSlide,
  createRef,
  slideTransition,
} 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());
  }
});