8000 GitHub - lucacattan3o/p5.js-export: A wrapper for CCapture.js that helps export p5.js sketch as a webm video
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

lucacattan3o/p5.js-export

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

p5.js Sketch Export

This wrapper can help you easely export your p5.js sketch as a webm video using CCapture.js library.

It can also be used to record interactions (eg. mouse interactions, music interaction) before the final export.

Demo

Check the demo and open the console in the browser.

Add ?export=true to the url to start the export.

Full url:

https://lucacattan3o.github.io/p5.js-export/demo/index.html?export=true

Setup

Load CCapture and p5-export in your project.

<script src="CCapture.all.min.js"></script>
<script src="https://unpkg.com/p5-export"></script>
<script src="sketch.js"></script>

Inside sketch.js, use sketchExportSetup() to instantiate the exporter and set the framerate equal to the sketch framerate.

let fps = 30;

function setup() {
  createCanvas(1080, 1080);
  frameRate(fps);
  sketchExportSetup({
    fps: fps
  })
}

A the end of draw() use this pattern:

function draw() {
  // Your visual here

  // Start the export
  if (frameCount == 1){
    sketchExportStart();
  }
  // Capture the frame
  sketchExport();
  // Stop the export after 6 seconds
  if (frameCount == 6 * fps){
    sketchExportEnd();
  }
}

The sketch is now ready to be exported.

Export the sketch

To start the export, add ?export=true to the url. Example:

http://127.0.0.1:5500/demo/?export=true

Open the browser console to see the export progress.

Record interactions

TBD

About

A wrapper for CCapture.js that helps export p5.js sketch as a webm video

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0