Replies: 1 comment
-
UPDATE: I tried to modify the canvas-keyboard-response plugin like so: Then, I tried to use the modified plugin in the following trial:
(Each shape[i] element represents a predefined function.) Unfortunately, triggering the console.log(location1) function yields "null," not the canvas object I want it to yield. Is there a way I can fix this? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone!
I am trying to run an experiment that uses the HTML 5 canvas for two trials. The tricky bit is that the regions of the canvas on which I draw my stimuli need to be randomized for each participant, so I must create/style the canvas dynamically. What I want to do is have a set of 16 mini-canvases and then randomly select 5 while the experiment is running.
My current approach is to run the experiment inside a div element (id = "experiment"), create a series of canvases during the experiment using document.createElement('canvas'), and then append each canvas to the div element. For example:
Unfortunately, when I try to run the above code, I get the following message in my debugger console: Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
Does anyone know what I am doing wrong?
Beta Was this translation helpful? Give feedback.
All reactions