Ccapture with up to date p5js

Hi guys,

I was trying to work out how to save animations with ccapture, a js library. I couldn’t get it to work, so I looked up an example that uses p5 and ccapture and found one here.

After getting confused for a long time, I discovered that the sketch & capture will only work if I run an older version of p5, which the example does. They use 0.7.2, I think I’m using 1.1.9 (I think, how do I actually check the version that I have locally? haha)

What could have changed between those versions that is disrupting the functionality of ccapture, and how could I make ccapture work in my sketch?
Thanks for your help!

EDIT:
Also, according to the example, the way to refer to the p5 canvas is like so: document.getElementById('defaultCanvas0'). I’m wondering how I could have worked that out on my own, I don’t believe it is mentioned anywhere in the reference?

1 Like
2 Likes

Thank you so much, that solves it!

I also noticed that you use .capture(canvas) instead of .capture('document.getElementById('defaultCanvas0')), which is of course much nicer, so thanks for that! Although I still wonder how I should find those kind of things myself…

I use a minified p5 which is auto installed by a VSC extension, so no comment blocks in there :frowning:

1 Like