render_on_canvas #1304
-
Hey everyone, I know the feature is really new, but I was struggling to get it to work because there aren't any examples yet. How can I present images when Thanks in advance :-) |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Hi Juli, This might be an edge case that we didn't catch in our testing. Can you post an example and the kind of images that you are using? |
Beta Was this translation helpful? Give feedback.
-
It happens with all my images in all my projects so far, so it's likely I got something wrong. EDIT: (Right now, |
Beta Was this translation helpful? Give feedback.
-
Hi @einGlasRotwein, thanks for reporting this and sharing your code - very helpful! When I ran your experiment, I noticed that the image didn't load right away, which is because you're using var picture_array = []; // for preloading
for (let i = 0; i < nTrials ; i ++) { // loop through picture numbers
pictures.push({ image : `${imgPath}${i}.jpg` }); // push to timeline variable array
picture_array.push(`${imgPath}${i}.jpg`);
}
// ...
jsPsych.init({
timeline: timeline,
preload_images: picture_array,
on_finish: function() {
jsPsych.data.displayData();
}
}); Can you check that this works on your end too? So I think this means that the |
Beta Was this translation helpful? Give feedback.
Hi @einGlasRotwein, thanks for reporting this and sharing your code - very helpful!
When I ran your experiment, I noticed that the image didn't load right away, which is because you're using
timelineVariables
for the image stimulus and the images aren't preloaded manually. I edited your code to manually preload the images, and now it works withrender_on_canvas: true
: