Im trying to generate images using coding in visual studio code. I want to add specific size for each image in each folder. for example I put this code below to show you what i mean. the code that I wrote below for example is taking the image Cigar.png from the folder 6-mouth and specifying its size and position, the same for other codes.
{
id: 0,
name: "Cigar",
path: `${dir}/6-mouth/Cigar.png`,
weight: 46,
position: { x: 331, y: 254 },
size: { width: 76, height: 115 },
},
{
id: 1,
name: "Cigarette",
path: `${dir}/6-mouth/Cigarette.png`,
weight: 45,
position: { x: 346, y: 326 },
size: { width: 80, height: 24 },
},
{
id: 2,
name: "Gum",
path: `${dir}/6-mouth/Gum.png`,
weight: 44,
position: { x: 352, y: 274 },
size: { width: 139, height: 115 },
},
{
id: 3,
name: "Pipe",
path: `${dir}/6-mouth/Pipe.png`,
weight: 43,
position: { x: 346, y: 262 },
size: { width: 100, height: 172 },
},
it show me this after typing node index.js in terminal.
// C:\Users\RobotiC\Desktop\index.js:80
// _element.layer.position.x,
// TypeError: Cannot read properties of undefined (reading 'x')
// at drawElement (C:\Users\RobotiC\Desktop\index.js:80:29)
// at C:\Users\RobotiC\Desktop\index.js:161:11
// at Array.forEach (<anonymous>)
// at C:\Users\RobotiC\Desktop\\index.js:160:22
// at async startCreating (C:\Users\RobotiC\Desktop\index.js:157:7)
// Node.js v17.7.2
// how can i fix it
// Thanks