xxxxxxxxxx
32
let manStanding1;
let animation = [];
let Standing1 = [];
function preload() {
manStanding1 = loadImage('man/Nakedman-StandingPose01.png');
}
function setup() {
createCanvas(100, 100);
frameRate(5);
let sprites = 8;
let sprite_movex = 0;
let sprite_width = 30;
let sprite_height = 40;
for (let i = 0; i < sprites; i++) {
let img = manStanding1.get(sprite_movex, 0, sprite_width, sprite_height);
sprite_movex = sprite_movex+sprite_width;
animation.push(img);
}
}
function draw() {
background(250);
image(animation[frameCount % animation.length], width/2-15, height/2-20);
}