URL of experiment: Pavlovia
Description of the problem:
My group is currently trying to develop a trail making experiment for use on Pavlovia.org. The objective is to lead the mouse cursor over various targets in the order specified. An example image of how our experiment looks like is below:
However, once the trial ends and the loop starts over again, the lines do not disappear. An example of what this looks like is below:
Here is the segment of code that controls the line making:
drawLine = function (shapeList) {
var lines, pos1, pos2;
lines = [];
if ((! (shapeList.length % 2))) {
while (shapeList.length) {
pos1 = shapeList.pop();
pos2 = shapeList.pop();
var newLine = new visual.ShapeStim({
win: win,
vertices: [ pos1.pos, pos2.pos ],
});
lines.append(newLine);
}
}
if (lines.length) {
for (var line, _pj_c = 0, _pj_a = lines, _pj_b = _pj_a.length; (_pj_c < _pj_b); _pj_c += 1) {
line = _pj_a[_pj_c];
line.setAutoDraw(true);
}
}
}
Essentially, a new ShapeStim is created once 2 points are put into the array, and this makes a line between the targets. So far, we are not sure how to remove the lines once the routine ends, nor are we sure as to how the other routine components get removed once the routine ends.
For those who try the online version, apologies for the lagging experiment, we are planning to create a new version once we solve this issue. The software platform is PsychoJs, the platform version is 2020.2.
Edit: The experiment also seems to work fine offline through PsychoPy v2020.2.3 as far as I can tell.
Any help is appreciated.