is it possible to draw stimuli with OSweb?
in OSWeb
Hey guys!
I want to create an experiment where participants have to recreate simple visual stimuli from memory. I'm thinking a drag and drop style test. Participants can select shapes drag them to the intended location and then cycle through some colors by repeatedly right clicking on the shape.
However I cant seem to find a method to draw on the surfaces OSweb creates. Any help would be appreciated!
Comments
Hi @reichardtr ,
In OSWeb, you cannot draw things programmatically onto a
Canvasobject in the same way that you can do that with a Python script in regular OpenSesame. However, what you can do, and what works ok in many situations, is to definesketchpaditems in terms of variables, and then usinginline_javascriptitems to manipulate these variables.To be a bit more specific, say that you initially show a
sketchpadwith stimuli that the participant can select by clicking on them. This is then followed by amouse_responsethat registers the location of a mouse click. Based on the variablescursor_xandcursor_yyou can then deduce which stimulus the participant clicked on, with some simple logic in aninline_javascriptitem, and assign this to, say, a variable calledselected_stimulus. Next, you collect another mouse click with anothermouse_response, and then finally show afeedbackitem that uses the variablescursor_x,cursor_y, andselected_stimulusto draw the selected stimulus on the location that the participant clicked on. That's a crude form of drag-and-drop, basically.Hope this helps!
— Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi Sebastiaan,
great idea, thank you! I am almost done with the task now, seems to work perfectly.
All the best,
Richard