Skip to content

Conversation

@humanbydefinition
Copy link

As discussed, this pull request includes the p5.js add-on library p5.asciify v0.10.1, alongside a basic p5.asciify-no_hooks snippet.

From my perspective, using p5.asciify without hooks is the most live-codeable way to use the add-on library without relying on hard compiles, while allowing for even more customization, including the integration of other fancy p5.js add-on libraries & drawing on top of the asciified canvas.

The snippet acts as a simple example. It is ideally expected to be applied onto a 'new' sketch with an empty draw() function and a setup function with just the createCanvas() call, with the canvas mode set to WEBGL. With this setup, the snippet can be applied and a basic sketch starts running with p5.asciify applied.

Unfortunately I haven't gotten to creating some actual examples yet, but I'm happy to contribute to that in the future. ✌️

From my perspective the most live-codeable way to use `p5.asciify` without relying on hard compiles, while allowing for even more customization, including the integration of other fancy p5.js add-on libraries and more.

Also acts as a simple example. This snippet is expected to be applied onto a 'new'  sketch with an empty `draw()` function and a setup function with just the `createCanvas()` call, with the canvas mode set to `WEBGL`. With this setup, the snippet can be applied and starts running immediately.
Now runs out of the box when applied to a `new` sketch.

Also added some calls to tinker with, which modify the p5.asciify output
@humanbydefinition
Copy link
Author

Hey @ffd8, hope you are doing well! I read your latest comment in the #119 issue and did some adjustments.

The snippet now runs out of the box when applied to a fresh sketch with the adjustments you suggested. I also added some p5.asciify calls to modify the output during run-time. It's quite a simple sketch, but it showcases the basic functionality the two pre-defined renderers "brightness" and "edge" provide.

I really really like the suggestion you made regarding providing more functionality directly through the p5asciify object, which is why I updated p5.asciify in that regard with v0.10.2, which is now also integrated in this PR.

p5asciify.fontSize(number) is now possible, and updates the font size of all managed asciifiers simultaneously. There are some additional functions that have been added which work similarly, but they are probably less interesting for live coding usage. https://p5.textmode.art/docs/api/classes/P5AsciifierManager

For now I haven't added stuff like p5asciify.characters() or p5asciify.invert(), since p5asciify.characters() would then update the set character set of all pre-defined renderers, meaning brightness-based and edge detection ones. That'd be unwanted in most cases I assume, which is why I haven't made these kind of adjustments yet. But thinking about it more again now, I'll probably have a solution for that in the near future. ✌️

@ffd8
Copy link
Owner

ffd8 commented Jun 29, 2025

@humanbydefinition – many thanks for this contribution(!), however for now I'm going to close it, since in the meantime, I decided that it's worth it to create a 'Snippets Manager' – something like a 'package manager' for snippets that are accessible within P5LIVE. Partially to prevent over-crowding of the built-in snippets (keeping them more general purpose to support any sketch) and use this Snippets Manager repo to allow anyone to share useful ones with the community (I also move my hy5 + hydra built-in examples to it).

You can already test out the Snippets Manager if you preview P5LIVE v1.7.0 (will launch very soon.. once done adding support for p5 v2 among other small things)

In a separate (or DM) thread, let's discuss a very basic demo that could be included in P5LIVE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants