Overlaying images with the jspsych reconstruction plugin #1949
-
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Which of the lines do you want to adjust? Can you share a screenshot of what this looks like using your current code with the various images identified? |
Beta Was this translation helpful? Give feedback.
-
You can do this by creating a set of HTML elements where only the one element is changing in response to the parameter from the var sample_function = function(stim_parameter){
var size = 50 + Math.floor(stim_parameter * 250);
var html = `
<div style="position: relative; width: 800px; height: 400px;">
<img src="img/PonzoBigRightClose.bmp" style="width:800px; height: 400px; position: absolute; z-index: 0">
<div id="left-line" style="width:10px; height: 100px; background-color: black; position: absolute; left: 200px; top: 200px; transform: translateY(-50%); z-index: 1;"></div>
<div id="right-line" style="width:10px; height: ${size}px; background-color: black; position: absolute; left: 600px; top: 200px; transform: translateY(-50%); z-index: 1;"></div>
</div>
`
} I didn't test this out, but I think it'll mostly work! |
Beta Was this translation helpful? Give feedback.
You can do this by creating a set of HTML elements where only the one element is changing in response to the parameter from the
reconstruction
plugin. The key concepts here are related to CSS positioning, which you'll need to use to get things aligned as you want. Here's a rough example, which hopefully can serve as a starting point: