JChan
August 27, 2018, 12:01am
1
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
Kevin
August 27, 2018, 12:06am
2
Sorry, but what’s your question? What happens when you run this code?
JChan
August 27, 2018, 12:15am
3
hi Kevin,
i just edit my post, thank for the help
when i run the p5, it’s show
thx
Jan
JChan
August 27, 2018, 2:11am
5
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.
A very important thing you still didn’t told us is whether my online sketch works for you or not.
1 Like
JChan
August 27, 2018, 3:43am
7
GoToLoop,
the online sketch also not work for me
i just see the black background, and no gif