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

**URL:** https://discourse.processing.org/t/a-begginer-having-a-problem-when-using-p5-gif-js/3002
**Category:** Libraries
**Created:** [August 27, 2018, 12:01am UTC](https://discourse.processing.org/t/a-begginer-having-a-problem-when-using-p5-gif-js/3002 "2018-08-27T00:01:27Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![JChan](https://avatars.discourse-cdn.com/v4/letter/j/838e76/32.png) [@JChan](https://discourse.processing.org/u/JChan)
#### Post date: [August 27, 2018, 12:01am UTC](https://discourse.processing.org/t/a-begginer-having-a-problem-when-using-p5-gif-js/3002/1 "2018-08-27T00:01:27Z")

</div>

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](https://github.com/antiboredom/p5.gif.js/tree/master)

below is my code:

```auto
var gif;

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

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

```

and i have insert

```auto
<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

 ![24](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/b/b723641770f8d18b57f9d429cc1638a8dbf93b0d.png)

---

<div class="post-metadata">

### Author: ![Kevin](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kevin/32/2297_2.png) [@Kevin](https://discourse.processing.org/u/Kevin)
#### Post date: [August 27, 2018, 12:06am UTC](https://discourse.processing.org/t/a-begginer-having-a-problem-when-using-p5-gif-js/3002/2 "2018-08-27T00:06:35Z")

</div>

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

---

<div class="post-metadata">

### Author: ![JChan](https://avatars.discourse-cdn.com/v4/letter/j/838e76/32.png) [@JChan](https://discourse.processing.org/u/JChan)
#### Post date: [August 27, 2018, 12:15am UTC](https://discourse.processing.org/t/a-begginer-having-a-problem-when-using-p5-gif-js/3002/3 "2018-08-27T00:15:19Z")

</div>

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

 ![24](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/b/b723641770f8d18b57f9d429cc1638a8dbf93b0d.png)

thx  
Jan

---

<div class="post-metadata">

### Author: ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)
#### Post date: [August 27, 2018, 1:09am UTC](https://discourse.processing.org/t/a-begginer-having-a-problem-when-using-p5-gif-js/3002/4 "2018-08-27T01:09:40Z")

</div>

- `http://p5js.SketchPad.cc/sp/pad/view/ro.COx$0Iy6rWpzsc/latest`
- [https://Forum.Processing.org/two/discussion/16053/p5-gif-question](https://Forum.Processing.org/two/discussion/16053/p5-gif-question)

---

<div class="post-metadata">

### Author: ![JChan](https://avatars.discourse-cdn.com/v4/letter/j/838e76/32.png) [@JChan](https://discourse.processing.org/u/JChan)
#### Post date: [August 27, 2018, 2:11am UTC](https://discourse.processing.org/t/a-begginer-having-a-problem-when-using-p5-gif-js/3002/5 "2018-08-27T02:11:11Z")

</div>

thx GoToLoop  
now i have change the code to

```auto
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

```auto

	<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

 ![01](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/a/a98efa55821c7e1e7245815f7a29074be63983be.png)

any thing i still do it wrong?  
thx so much

---

<div class="post-metadata">

### Author: ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)
#### Post date: [August 27, 2018, 2:28am UTC](https://discourse.processing.org/t/a-begginer-having-a-problem-when-using-p5-gif-js/3002/6 "2018-08-27T02:28:03Z")

</div>

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

---

<div class="post-metadata">

### Author: ![JChan](https://avatars.discourse-cdn.com/v4/letter/j/838e76/32.png) [@JChan](https://discourse.processing.org/u/JChan)
#### Post date: [August 27, 2018, 3:43am UTC](https://discourse.processing.org/t/a-begginer-having-a-problem-when-using-p5-gif-js/3002/7 "2018-08-27T03:43:45Z")

</div>

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