From 6a3ce850c5bb28875d424230998e811a699df37d Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Wed, 7 Feb 2024 11:06:03 -0700 Subject: [PATCH] more --- package-lock.json | 47 ++++---- package.json | 10 +- script.md | 35 +++--- src/project.meta | 2 +- src/scenes/doctor.tsx | 55 ++++++++++ src/scenes/first_box.tsx | 156 +++++++++++++++++++++++++++ src/scenes/flirtingwithfunctions.tsx | 16 +-- src/scenes/index.ts | 11 +- src/scenes/itinerary.meta | 3 - src/scenes/me.tsx | 24 ++--- src/scenes/partone.tsx | 2 +- src/scenes/title.tsx | 4 +- 12 files changed, 285 insertions(+), 80 deletions(-) create mode 100644 src/scenes/doctor.tsx create mode 100644 src/scenes/first_box.tsx delete mode 100644 src/scenes/itinerary.meta diff --git a/package-lock.json b/package-lock.json index 76dfc14..4ccc7ba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,13 +8,13 @@ "name": "compilinglambda", "version": "0.0.0", "dependencies": { - "@motion-canvas/2d": "^3.13.0", - "@motion-canvas/core": "^3.13.0", + "@motion-canvas/2d": "^3.14.0", + "@motion-canvas/core": "^3.14.0", "@motion-canvas/ffmpeg": "^1.1.0" }, "devDependencies": { - "@motion-canvas/ui": "^3.13.0", - "@motion-canvas/vite-plugin": "^3.13.0", + "@motion-canvas/ui": "^3.14.0", + "@motion-canvas/vite-plugin": "^3.14.0", "typescript": "^5.2.2", "vite": "^4.0.0" } @@ -587,20 +587,20 @@ ] }, "node_modules/@motion-canvas/2d": { - "version": "3.13.0", - "resolved": "https://registry.npmjs.org/@motion-canvas/2d/-/2d-3.13.0.tgz", - "integrity": "sha512-FrQumHi7wTsik27rHvQ9ZO8Uq4lmcMurEwGPkoCAb+cp+K4gLUhczLvrkXb14fCJ2Ie4QxClnGVfs7hYD4MGDw==", + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/@motion-canvas/2d/-/2d-3.14.1.tgz", + "integrity": "sha512-9bwpp/3bbaXycK4yGY2pD1qyZuHmVcf+cgMAhw9Xu/QSMbElh68u5bguN6AXLpaRxAWWLu9lGtf6Pws7tRgv4g==", "dependencies": { - "@motion-canvas/core": "^3.13.0", + "@motion-canvas/core": "^3.14.1", "code-fns": "^0.8.2", "mathjax-full": "^3.2.2", "parse-svg-path": "^0.1.2" } }, "node_modules/@motion-canvas/core": { - "version": "3.13.0", - "resolved": "https://registry.npmjs.org/@motion-canvas/core/-/core-3.13.0.tgz", - "integrity": "sha512-W1mkJQs2XW4pDB1DkG9ptPv4EjrpQcYSRUdJW1wLT1UDqVcDtPrlCx3w2MM5cJmNZGl1DdJn9K5Uw12iri6jBA==", + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/@motion-canvas/core/-/core-3.14.1.tgz", + "integrity": "sha512-1rEys/mOa1WwUttAeHOQwDoLDcVNsFhNIO6YDVTzEGWYMGhHavEsVWdWD8YaDRbBkcHwd1uLKtIahyjERzBnjw==", "dependencies": { "@types/chroma-js": "^2.1.4", "chroma-js": "^2.4.2" @@ -622,24 +622,25 @@ } }, "node_modules/@motion-canvas/ui": { - "version": "3.13.0", - "resolved": "https://registry.npmjs.org/@motion-canvas/ui/-/ui-3.13.0.tgz", - "integrity": "sha512-ARZzuJELaYrpgs3InhcwU67ZxaWnX0OCLx4U2RMxjNWCo1yxBZ9B4ZGN8Ei2BGdUxLCVa9Rs3A+nTX7FbjLGtA==", + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/@motion-canvas/ui/-/ui-3.14.1.tgz", + "integrity": "sha512-6HLqzDnLUVyURGVl8hFvq6AOirlxz0ROnQlEgBiryRmdmJ/eSrZ3nVpxVCP2fp8AJ2f2KwHBNtwXyLv+xq1Uyw==", "dev": true, "dependencies": { - "@motion-canvas/core": "^3.13.0", + "@motion-canvas/core": "^3.14.1", "@preact/signals": "^1.2.1", "preact": "^10.19.2" } }, "node_modules/@motion-canvas/vite-plugin": { - "version": "3.13.0", - "resolved": "https://registry.npmjs.org/@motion-canvas/vite-plugin/-/vite-plugin-3.13.0.tgz", - "integrity": "sha512-f/yfoeBsb5XmD4Ny0SMHAz9aycyvXVR48Lbj15iVllXRCgtbKjSfbTgeAp8zf2S6qSu/BnuhUrVuZ55QhVjtnQ==", + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/@motion-canvas/vite-plugin/-/vite-plugin-3.14.1.tgz", + "integrity": "sha512-INkDrLmGRLwXlVrHSo7LMbORimYkxlE2DnBnuRdkHF6JeTxeUU+KtHTSW+vTg55cwEz2UykIIW2Tc0KicOU11Q==", "dependencies": { "fast-glob": "^3.3.1", "follow-redirects": "^1.15.2", - "mime-types": "^2.1.35" + "mime-types": "^2.1.35", + "source-map": "^0.6.1" }, "peerDependencies": { "vite": "4.x || 5.x" @@ -1147,6 +1148,14 @@ "queue-microtask": "^1.2.2" } }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/source-map-js": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", diff --git a/package.json b/package.json index f5a9521..8b20ec9 100644 --- a/package.json +++ b/package.json @@ -8,14 +8,14 @@ "build": "tsc && vite build" }, "dependencies": { - "@motion-canvas/core": "^3.13.0", - "@motion-canvas/2d": "^3.13.0", + "@motion-canvas/core": "^3.14.0", + "@motion-canvas/2d": "^3.14.0", "@motion-canvas/ffmpeg": "^1.1.0" }, "devDependencies": { - "@motion-canvas/ui": "^3.13.0", - "@motion-canvas/vite-plugin": "^3.13.0", + "@motion-canvas/ui": "^3.14.0", + "@motion-canvas/vite-plugin": "^3.14.0", "typescript": "^5.2.2", "vite": "^4.0.0" } -} \ No newline at end of file +} diff --git a/script.md b/script.md index 5554626..e18b46f 100644 --- a/script.md +++ b/script.md @@ -3,10 +3,13 @@ About Me "For the new faces, I'm Elizabeth, or simponic on the discord..." -- I'm 20 years old, graduating this semester once I'm done with my final general class I missed on my grad plan (2credits only, ugh) -- I've been enjoying programs functionally for over 3 years; in LISP and Elixir mostly +- I love functional programming; I've been enjoying programs functionally for over 3 years; in LISP and Elixir mostly +- Soon to be SDE at AWS +- I'm 20 years old, graduating this semester once I'm done with my final general class I missed on my grad plan (2credits only, ugh, ask me after if you want to hear the bureacracy) - I was president of the USU Linux club from 2021 - 2024 +Of course this presentation is open source at the link you see on the board. + Part One === @@ -20,33 +23,29 @@ Tomorrow's Valentine's day, but you realize; you don't have a Valentine! Desparate to make yourself feel better, you turn to your computer and open Emacs, querying "m-x doctor". ``` -I am the psychotherapist. Please, describe your problems. Each time -you are finished talking, type RET twice. - +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. +> 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 answer no 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 ``` -What could exist out there that provides this? Let's put a pin in that; it looks like we have a black box here that -came out of nowhere. What does it do? +well that's not super helpful -When we feed it a one and press a button, it returns one. When we feed it a two, it returns one. A three, two. A four, three. And so forth. +It looks like we have a black box here that came out of nowhere. What does it do? + +When we feed it a one and put it at this arrow, it returns one. When we feed it a two, it returns one. A three, two. A four, three. And so forth. No matter how many times we put a number in it gives me the same answer; we're all in love with it already. So we're ready to start getting to know this so called "function". Where could our curiosity take us? diff --git a/src/project.meta b/src/project.meta index c228504..9093235 100644 --- a/src/project.meta +++ b/src/project.meta @@ -4,7 +4,7 @@ "background": "rgb(30,30,46)", "range": [ 0, - null + 33.18333233333333 ], "size": { "x": 1920, 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(); + + yield view.add( + , + ); + + 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()); + } +}); diff --git a/src/scenes/first_box.tsx b/src/scenes/first_box.tsx new file mode 100644 index 0000000..4927157 --- /dev/null +++ b/src/scenes/first_box.tsx @@ -0,0 +1,156 @@ +import { + Img, + Rect, + Node, + Video, + makeScene2D, + Txt, + Line, + LineSegment, +} from "@motion-canvas/2d"; +import { + Direction, + beginSlide, + createRef, + map, + slideTransition, + tween, + all, + waitFor, +} from "@motion-canvas/core"; + +import { CodeBlock } from "@motion-canvas/2d/lib/components/CodeBlock"; +import { theme } from "../theme"; + +const fibonacciFn = (n: number): number => { + if (n <= 2) { + return 1; + } + return fibonacciFn(n - 1) + fibonacciFn(n - 2); +}; + +const fibonacci = ` +const fibonacci = (n: number): number => { + if (n <= 2) { + return 1; + } + return fibonacci(n - 1) + fibonacci(n - 2); +}; +` + .split("\n") + .filter((x) => x.trim()) + .join("\n"); + +export default makeScene2D(function* (view) { + const block = createRef(); + const node = createRef(); + const rect = createRef(); + + const boxMoji = createRef(); + const inSegment = createRef(); + const outSegment = createRef(); + const input = createRef(); + const output = createRef(); + + yield* view.add( + <> + + + + + + + 😴 + + + + + + , + ); + + yield boxMoji().position(rect().middle()); + yield* slideTransition(Direction.Left); + + yield* beginSlide("Black Box"); + + const padding = 100; + const left = rect().left(); + const right = rect().right(); + yield* all( + inSegment().points([left.addX(-padding), left], 0.5), + outSegment().points([right, right.addX(padding)], 0.5), + ); + yield input().position(left.addX(-padding)); + yield output().position(right); + for (const i of [1, 2, 3]) { + yield* all( + input().opacity(1, 0.5), + input().text(i.toString(), 0.5), + input().position(left.addX(-padding - 20), 0.5), + ); + + yield* beginSlide("Input " + i); + + yield* input().position(left, 0.5); + yield* all(input().opacity(0, 0.2), boxMoji().text("👷‍♀️⚙️", 0.2)); + yield* waitFor(0.5); + + const result = fibonacciFn(i); + yield* all( + output().opacity(1, 0.5), + output().text(result.toString(), 0.5), + output().position(right, 0.5), + ); + + yield* all(boxMoji().text("😴", 0.2)); + + yield* beginSlide("Output " + i); + } + + yield* all( + boxMoji().opacity(0, 0.2), + block().fontSize(30, 1), + node().opacity(1, 1), + ); + + yield* beginSlide("Revealing"); +}); diff --git a/src/scenes/flirtingwithfunctions.tsx b/src/scenes/flirtingwithfunctions.tsx index f833ce9..7f5f9da 100644 --- a/src/scenes/flirtingwithfunctions.tsx +++ b/src/scenes/flirtingwithfunctions.tsx @@ -1,13 +1,5 @@ -import { Img, Layout, Txt, Video, makeScene2D } from "@motion-canvas/2d"; -import { - Direction, - beginSlide, - createRef, - map, - slideTransition, - tween, -} from "@motion-canvas/core"; -import { theme } from "../theme"; +import { Img, Video, makeScene2D } from "@motion-canvas/2d"; +import { beginSlide, createRef, map, tween } from "@motion-canvas/core"; import sad from "../../public/img/sad.mp4"; import emacsmac from "../../public/img/emacsmac.jpg"; @@ -17,8 +9,8 @@ export default makeScene2D(function* (view) { const startX = 1200; const endX = 300; - view.add(