Hi! I know this is a broad question but I think its not only mine and I can’t find a discussion over this anywhere. Please excuse any typos or mistakes in my writing because I’m not a native English speaker. Let’s cut to the point -
I’ve been trying to implement some p5 code into my Tumblr, and here is where I’ve gotten so far:
1 - I’ve manage doing it for a very simple sketch using the Theme Resources on Tumblr (I’ve added the full p5.js and p5.dom.js libraries and a simple sketch.js file).
2. As soon as I tried more complex sketches with instance mode or classes and functions outside the setup and draw functions Tumblr said i’m not allowed to upload these files. NOTE that these sketches are fully functional on my computer using node.js to run a local server, so it is not a problem with the code itself, but with implementing it on Tumblr.
3 - I’ve trying writing the skecth on Instance Mode directly on the HTML inside script tags but that doesn’t work, it seems p5 needs a separate “.js” file named “skecth.js”, and this file pointed on on the html page for it to work. Is this actually the case, can’t I write p5 code directly on the HTML? For example:
<script>
var sketch1 = function(p){
/* setup, draw, classes and other functions here */
};
var myp5 = new p5(sketch1, "canvas1");
</script>
...
<body>
<div id = "canvas1">
...
4 - I’ve found a way to post Processing sketches as Tumblr posts (Insert sketch in tumblr) but I want p5.js sketches and not Processing ones, and I can’t find anywhere how to do this.
So, If possible I would like to insert running p5.js sketches on my Home Page via the Theme HTML but also posting text with some running simple sketch would be great (I know I would have to use Instance Mode to create multiple canvas). But if not possible at least having an animation running on the background of the home page would be fine.