Description of the problem:
My experiment requires participants to drag and drop a stimulus, and for this stimulus to reset to position = (0,0) for the next trial.
I used a code components to do this (my experiment is named builderonly because I wanted to add my code components one at a time so I can debug where the issues are so it started life as builder only)
This works fine in Psychopy locally however in JS online the stimulus from the previous trial remains on screen in the position it was dragged to.
I tried setting the opacity = 0 in End routine so it would fade into the background but in Psychopy this did not take effect until the start of the next trial (no change in JS).
I also tried resetting the position back to 0,0 at end routine and this also did not take effect until the start of the next trial in Psychopy (no change JS).
I think the the challenge in coding this is making sure that the code can decipher the stimulus in the previous trial from the stimulus in the current trial and I’m not sure how to do this.
My other idea was to refresh the screen however I know that the crib sheet does not advise the use of win.flip().
I’ve had help on this issue based on a question I asked in another thread.
The reason the stimuli remained on screen into the next trial was because I misunderstood the drag and drop process.
At its most basic you do not need the createPiece function from the demo (because you don’t need any more pieces and that is what was being drawn onto the screen in my case and persisting into the next trial).
The lines of code needed for drag and drop can be found in the following thread: