Unable to load any files, image, font, etc.

Hello,

I am trying to write text in p5.js, but when I loadfont, nothing happens.

I have called the libraries in the head of my html, have the library and font files in the correct folders, but they are apparently not loading. I tried it with images, too, and the same issue occurs. I've googled my heart out, and can't find anyone else who has had this issue.

Here is the code in my sketch.js file: var font; function preload() { font = loadFont('assets/ATCKrueger-Bold.otf'); } function setup() { fill('#ED225D'); textFont(font); textSize(36); text('test', 10, 50); }

My HTML file looks like this: <html> <head> <meta charset="UTF-8"> <script language="javascript" type="text/javascript" src="libraries/p5.js"></script> <!-- uncomment lines below to include extra p5 libraries --> <script language="javascript" src="libraries/p5.dom.js"></script> <script language="javascript" src="libraries/p5.sound.js"></script> <script language="javascript" type="text/javascript" src="sketch.js"></script> <!-- this line removes any default padding and style. you might only need one of these values set. --> <style> body {padding: 0; margin: 0;} </style> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> </body> </html>

This is what I get when I load the page:

Screen Shot 2015-12-06 at 10.40.21 PM

The same thing happens with this code in sketch.js: var img; function preload() { img = loadImage("assets/cat.jpg"); } function setup() { image(img, 0, 0); }

I feel like I must be missing something very obvious, because I just can't figure out this very simple command. Does anyone else have this problem? Can anyone help?

Answers

Sign In or Register to comment.