Created
December 10, 2017 15:06
-
-
Save jwulf/9e30140bcdf26d2da50ebad1e7e161ff to your computer and use it in GitHub Desktop.
Record your movement in Minecraft using Magikcraft
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Capture a video of your movement in Minecraft. | |
| */ | |
| const magik = magikcraft.io; | |
| function cam_capture(seconds = "--help", fps = 20) { | |
| if (seconds === "--help") { | |
| magik.dixit("Usage: /cast cam_capture [secs]"); | |
| magik.dixit("Usage: /cast cam_capture [secs] [fps]"); | |
| return; | |
| } | |
| global.film = {}; | |
| film.frames = []; | |
| film.metadata = { | |
| fps, | |
| seconds | |
| }; | |
| const interval = 1000 / fps; | |
| const totalFrames = fps * seconds; | |
| magik.dixit(`Recording ${seconds}s at ${fps} fps`); | |
| let count = 0; | |
| const camera = magik.setInterval(()=>{ | |
| const location = magik.getSender().getLocation(); | |
| film.frames.push(location); | |
| count ++; | |
| if (count > totalFrames) { | |
| magik.clearInterval(camera); | |
| magik.dixit('Finished recording!'); | |
| } | |
| }, interval); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment