I’m so stuck. I have been using the p5.js editor online and I am loving it. But I want to include the sketch in an html page, eventually making it an animated header. So I’m trying to work it out. I’ve downloaded, and sketches come up if they don’t have the WEBGL fonts in them. If a sketch has a WEBGL parameter in the canvas, then I just get Loading… and that never goes away. I’ve put the .ttf in the same folder as the sketch, and in an assets folder in that folder.
var newFont;
function preload(){
newFont = loadFont ('Play-Bold.ttf');
}
function setup() {
createCanvas(400, 400, WEBGL);
textFont (newFont);
textSize (30);
}
function draw() {
background(0);
text("Play font", 20, 20);
}
And these are lines I put in the head section:
Script src="http ://cdnjs.cloudflare.com/ajax/libs/p5.js/0.10.2/p5.js
Script src="http ://cdnjs.cloudflare.com/ajax/libs/p5.js/0.10.2/addons/p5.sound.min.js"
And this line goes in the body
Script src="specialFont.js"
Apologies if I posted wrong, or too long. I already had to edit because I see pasting code in tags doesn’t show up. >>red face<<
But I really do hope someone can help me with this! I just don’t get what I am supposed to do with the AJAX or alternatives.
Very many thanks, if you can.
Melissa