xxxxxxxxxx
30
/**
* demonstrates how to load a GIF image using
* createImg to create an <img> on the page
* and to use that to update animation
* (and illustrates how p5's loadImage loads only
* one frame otherwise).
*/
var gif_loadImg, gif_createImg;
function preload() {
gif_loadImg = loadImage("Lunidin.gif");
gif_createImg = createImg("Lunidin.gif");
}
function setup() {
createCanvas(500, 700);
background(0);
}
function draw() {
// loads only first frame
image(gif_loadImg, 50, 50);
// updates animation frames by using an html
// img element, positioning it over top of
// the canvas.
gif_createImg.position(50, 350);
}