123456789101112131415161718192021222324252627 |
- // carregando imagens - HTMLImageElement
- function loadImages() {
- imagesUrl.forEach((url) => {
- let img = new Image(); //HTMLImageElement
- img.onload = () => {
- images.push(img);
- }
- img.src = url;
- });
- }
- function drawImages() {
- let i = 0;
- images.forEach((img) => {
- let context = canvas.getContext("2d");
- context.drawImage(img, i, 0);
- i += 300;
- });
- }
- let images = [];
- let imagesUrl = [
- "img/garage.png",
- "img/house.png",
- ];
|