diff options
author | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2024-02-02 13:17:24 -0700 |
---|---|---|
committer | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2024-02-02 13:17:24 -0700 |
commit | 7d822f2ba2359e87d65c08a5a2a10e242e246b76 (patch) | |
tree | bb34c6feaefd815e8516a4a3ab7733311afb945e /src/scenes/flirtingwithfunctions.tsx | |
parent | 29dc79359a5bd85f492854c2bd6df320904dfdd2 (diff) | |
download | compiling-the-lambda-calculus-7d822f2ba2359e87d65c08a5a2a10e242e246b76.tar.gz compiling-the-lambda-calculus-7d822f2ba2359e87d65c08a5a2a10e242e246b76.zip |
add animation
Diffstat (limited to 'src/scenes/flirtingwithfunctions.tsx')
-rw-r--r-- | src/scenes/flirtingwithfunctions.tsx | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/scenes/flirtingwithfunctions.tsx b/src/scenes/flirtingwithfunctions.tsx new file mode 100644 index 0000000..ede0df9 --- /dev/null +++ b/src/scenes/flirtingwithfunctions.tsx @@ -0,0 +1,33 @@ +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 sad from "../../public/img/sad.mp4"; +import emacsmac from "../../public/img/emacsmac.jpg"; + +export default makeScene2D(function* (view) { + const vid = createRef<Video>(); + const img = createRef<Img>(); + const startX = 1200; + const endX = 300; + + view.add(<Video width={300} ref={vid} src={sad} x={0} />); + view.add(<Img width={200} ref={img} src={emacsmac} x={startX} />); + + vid().loop(true); + vid().play(); + + yield* beginSlide("No Valentine"); + + yield* tween(4.2, (val) => { + img().position.x(map(startX, endX, val)); + }); + + yield* beginSlide("Going To The Doctor"); +}); |