A begginer having a problem when using p5.gif.js

hi everyone,
i’m a beginner of P5js
i face a problem when i using p5.gif.js library to display a gif,
https://github.com/antiboredom/p5.gif.js/tree/master

below is my code:

var gif;

function setup() {
  createCanvas(700, 300);
  gif = loadGif('ppp.gif');
}

function draw() {
  background(0);
  image(gif, 0, 0);
}

and i have insert

<script src="libraries/p5.gif.js"></script>
<script src="libraries/p5.gif.min.js"></script>

in my html file.
and i have this msg in my console

Sorry, but what’s your question? What happens when you run this code?

hi Kevin,
i just edit my post, thank for the help
when i run the p5, it’s show

thx
Jan

thx GoToLoop
now i have change the code to

var gif;

function setup() {
  createCanvas(700, 300);
  gif = loadGif('ppp.gif');
}

function draw() {
  background(255,0,0,2);
   gif.loaded() && image(gif, 0, 0)
}

and my html as follow


	<script src="libraries/p5.js"></script>
	<script src="libraries/p5.dom.js"></script>
	<script src="libraries/p5.sound.js"></script>
	<script src="libraries/p5.gif.js"></script>
	<script src="sketch.js"></script>

this time no error msg, but still no gif display on canvas
as follow

any thing i still do it wrong?
thx so much

Sorry. Can’t tell by your code alone what might be wrong. :anguished:
A very important thing you still didn’t told us is whether my online sketch works for you or not. :roll_eyes:

1 Like

GoToLoop,
the online sketch also not work for me
i just see the black background, and no gif