I have a variable component (imList) declared at the beginning of the routine, the start value is set to obtain some image names in my condition file, split by “,”, see below -
It runs fine locally with PsychoPy without any problem. However, when I convert this experiment online, it seems that this variable component is not initialized in the JS code, and has the error below -
I was wondering why the variable component is not declared in the auto-generated and what’s the proper way to resolve this issue.
Yet another question I have is how to plot multiple images at the same time -
I have a template image component called imageSample. Locally, I copy the image component 60 times:
for i in range(60):
images.append(copy.copy(imageSample))
And then plot the 60 images simultaneously in each frame:
for i in range(60):
images[i].image = imList[i]
images[i].draw()
This works perfectly when running with PsychoPy.
With PsychoJS, I’m not sure I copied the images in the right way, but I changed append to push:
images = [];
for (var i = 0; i<60; i++) {
images.push(imageSample);
images[i].image = imList[i];
}
And under each frame, I tried to plot all 60 images by:
for (var i = 0; i<60;i++) {
images[i].setAutoDraw(true);
}
This, however, only plots one image, instead of 60, so I guess there must be something wrong.
There’s no error though.
Any thought?