diff --git a/contributors.md b/contributors.md index b2dcb9c3..ab76f33e 100644 --- a/contributors.md +++ b/contributors.md @@ -5,7 +5,9 @@ The following people have contributed to the development of jsPsych by writing c * Steve Chao - https://github.com/stchao * Krisitn Diep - https://github.com/kristiyip * Becky Gilbert - https://github.com/becky-gilbert +* Angus Hughes - https://github.com/awhug * Gustavo Juantorena - https://github.com/GEJ1 +* Chris Jungerius - https://github.com/cjungerius * Jana Klaus - https://github.com/janakl4us * Jonas Lambers * Shane Martin - https://github.com/shamrt diff --git a/docs/plugins/jspsych-audio-button-response.md b/docs/plugins/jspsych-audio-button-response.md index 7c68fe13..c68e5788 100644 --- a/docs/plugins/jspsych-audio-button-response.md +++ b/docs/plugins/jspsych-audio-button-response.md @@ -23,6 +23,7 @@ margin_vertical | string | '0px' | Vertical margin of the button(s). margin_horizontal | string | '8px' | Horizontal margin of the button(s). response_ends_trial | boolean | true | If true, then the trial will end whenever the subject makes a response (assuming they make their response before the cutoff specified by the `trial_duration` parameter). If false, then the trial will continue until the value for `trial_duration` is reached. You can set this parameter to `false` to force the subject to listen to the stimulus for a fixed amount of time, even if they respond before the time is complete. trial_ends_after_audio | boolean | false | If true, then the trial will end as soon as the audio file finishes playing. +response_allowed_while_playing | boolean | true | If true, then responses are allowed while the audio is playing. If false, then the audio must finish playing before the button choices are enabled and a response is accepted. Once the audio has played all the way through, the buttons are enabled and a response is allowed (including while the audio is being re-played via on-screen playback controls). ## Data Generated diff --git a/docs/plugins/jspsych-audio-keyboard-response.md b/docs/plugins/jspsych-audio-keyboard-response.md index 36f29548..c17eb11d 100644 --- a/docs/plugins/jspsych-audio-keyboard-response.md +++ b/docs/plugins/jspsych-audio-keyboard-response.md @@ -20,6 +20,7 @@ prompt | string | null | This string can contain HTML markup. Any content here w trial_duration | numeric | null | How long to wait for the subject to make a response before ending the trial in milliseconds. If the subject fails to make a response before this timer is reached, the subject's response will be recorded as null for the trial and the trial will end. If the value of this parameter is null, then the trial will wait for a response indefinitely. response_ends_trial | boolean | true | If true, then the trial will end whenever the subject makes a response (assuming they make their response before the cutoff specified by the `trial_duration` parameter). If false, then the trial will continue until the value for `trial_duration` is reached. You can use set this parameter to `false` to force the subject to listen to the stimulus for a fixed amount of time, even if they respond before the time is complete. trial_ends_after_audio | boolean | false | If true, then the trial will end as soon as the audio file finishes playing. +response_allowed_while_playing | boolean | true | If true, then responses are allowed while the audio is playing. If false, then the audio must finish playing before a keyboard response is accepted. Once the audio has played all the way through, a valid keyboard response is allowed (including while the audio is being re-played via on-screen playback controls). ## Data Generated diff --git a/docs/plugins/jspsych-audio-slider-response.md b/docs/plugins/jspsych-audio-slider-response.md index 7d694e49..6a9f2502 100644 --- a/docs/plugins/jspsych-audio-slider-response.md +++ b/docs/plugins/jspsych-audio-slider-response.md @@ -26,6 +26,7 @@ require_movement | boolean | false | If true, the subject must move the slider b prompt | string | null | This string can contain HTML markup. Any content here will be displayed below the stimulus. The intention is that it can be used to provide a reminder about the action the subject is supposed to take (e.g., which key to press). trial_duration | numeric | null | How long to wait for the subject to make a response before ending the trial in milliseconds. If the subject fails to make a response before this timer is reached, the subject's response will be recorded as null for the trial and the trial will end. If the value of this parameter is null, then the trial will wait for a response indefinitely. response_ends_trial | boolean | true | If true, then the trial will end whenever the subject makes a response (assuming they make their response before the cutoff specified by the `trial_duration` parameter). If false, then the trial will continue until the value for `trial_duration` is reached. You can set this parameter to `false` to force the subject to listen to the stimulus for a fixed amount of time, even if they respond before the time is complete. +response_allowed_while_playing | boolean | true | If true, then responses are allowed while the audio is playing. If false, then the audio must finish playing before the slider is enabled and the trial can end via the next button click. Once the audio has played all the way through, the slider is enabled and a response is allowed (including while the audio is being re-played via on-screen playback controls). ## Data Generated diff --git a/docs/plugins/jspsych-canvas-button-response.md b/docs/plugins/jspsych-canvas-button-response.md new file mode 100644 index 00000000..83efc64d --- /dev/null +++ b/docs/plugins/jspsych-canvas-button-response.md @@ -0,0 +1,66 @@ +# jspsych-canvas-button-response + +This plugin can be used to draw a stimulus on a [HTML canvas element](https://www.w3schools.com/html/html5_canvas.asp), and record a button click response and response time. The canvas stimulus can be useful for displaying dynamic, parametrically-defined graphics, and for controlling the positioning of multiple graphical elements (shapes, text, images). The stimulus can be displayed until a response is given, or for a pre-determined amount of time. The trial can be ended automatically if the subject has failed to respond within a fixed length of time. One or more button choices will be displayed under the canvas, and the button style can be customized using HTML formatting. + +## Parameters + +Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. + +Parameter | Type | Default Value | Description +----------|------|---------------|------------ +stimulus | function | *undefined* | The function to draw on the canvas. This function automatically takes a canvas element as its only argument, e.g. `function(c) {...}` or `function drawStim(c) {...}`, where `c` refers to the canvas element. Note that the stimulus function will still generally need to set the correct context itself, using a line like `let ctx = c.getContext("2d")`. +canvas_size | array | [500, 500] | Array that defines the size of the canvas element in pixels. First value is height, second value is width. +choices | array of strings | [] | Labels for the buttons. Each different string in the array will generate a different button. +button_html | HTML string | `''` | A template of HTML for generating the button elements. You can override this to create customized buttons of various kinds. The string `%choice%` will be changed to the corresponding element of the `choices` array. You may also specify an array of strings, if you need different HTML to render for each button. If you do specify an array, the `choices` array and this array must have the same length. The HTML from position 0 in the `button_html` array will be used to create the button for element 0 in the `choices` array, and so on. +prompt | string | null | This string can contain HTML markup. Any content here will be displayed below the stimulus. The intention is that it can be used to provide a reminder about the action the subject is supposed to take (e.g., what question to answer). +trial_duration | numeric | null | How long to wait for the subject to make a response before ending the trial in milliseconds. If the subject fails to make a response before this timer is reached, the subject's response will be recorded as null for the trial and the trial will end. If the value of this parameter is null, the trial will wait for a response indefinitely. +stimulus_duration | numeric | null | How long to display the stimulus in milliseconds. The visibility CSS property of the stimulus will be set to `hidden` after this time has elapsed. If this is null, then the stimulus will remain visible until the trial ends. +margin_vertical | string | '0px' | Vertical margin of the button(s). +margin_horizontal | string | '8px' | Horizontal margin of the button(s). +response_ends_trial | boolean | true | If true, then the trial will end whenever the subject makes a response (assuming they make their response before the cutoff specified by the `trial_duration` parameter). If false, then the trial will continue until the value for `trial_duration` is reached. You can use this parameter to force the subject to view a stimulus for a fixed amount of time, even if they respond before the time is complete. + +## Data Generated + +In addition to the [default data collected by all plugins](overview#data-collected-by-plugins), this plugin collects the following data for each trial. + +Name | Type | Value +-----|------|------ +rt | numeric | The response time in milliseconds for the subject to make a response. The time is measured from when the stimulus first appears on the screen until the subject's response. +button_pressed | numeric | Indicates which button the subject pressed. The first button in the `choices` array is 0, the second is 1, and so on. + +Note: the canvas stimulus is *not* included in the trial data because it is a function. Any stimulus information that should be saved in the trial data can be added via the `data` parameter. + +## Examples + +### Displaying question until subject gives a response + +```javascript +function filledCirc(canvas, radius, color){ + var ctx = canvas.getContext("2d"); + ctx.beginPath(); + ctx.arc(250, 250, radius, 0, 2 * Math.PI); + ctx.fillStyle = color; + ctx.fill() +} + +var circle_1 = { + type: 'canvas-button-response', + stimulus: function (c) { + filledCirc(c, 100, 'blue'); + }, + choices: ['Red', 'Green', 'Blue'], + prompt: '
What color is the circle?
' + data: {color: 'blue', radius: 100} +}; + +var circle_2 = { + type: 'canvas-button-response', + stimulus: function (c) { + filledCirc(c, 150, 'green'); + }, + choices: ['Larger', 'Smaller'], + prompt: 'Is this circle larger or smaller than the last one?
', + data: {color: 'green', radius: 150} +}; + +``` \ No newline at end of file diff --git a/docs/plugins/jspsych-canvas-keyboard-response.md b/docs/plugins/jspsych-canvas-keyboard-response.md new file mode 100644 index 00000000..46273f5a --- /dev/null +++ b/docs/plugins/jspsych-canvas-keyboard-response.md @@ -0,0 +1,68 @@ +# jspsych-canvas-keyboard-response + +This plugin can be used to draw a stimulus on a [HTML canvas element](https://www.w3schools.com/html/html5_canvas.asp) and record a keyboard response. The canvas stimulus can be useful for displaying dynamic, parametrically-defined graphics, and for controlling the positioning of multiple graphical elements (shapes, text, images). The stimulus can be displayed until a response is given, or for a pre-determined amount of time. The trial can be ended automatically if the subject has failed to respond within a fixed length of time. + +## Parameters + +Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. + +Parameter | Type | Default Value | Description +----------|------|---------------|------------ +stimulus | function | *undefined* | The function to draw on the canvas. This function automatically takes a canvas element as its only argument, e.g. `function(c) {...}` or `function drawStim(c) {...}`, where `c` refers to the canvas element. Note that the stimulus function will still generally need to set the correct context itself, using a line like `let ctx = c.getContext("2d")`. +canvas_size | array | [500, 500] | Array that defines the size of the canvas element in pixels. First value is height, second value is width. +choices | array of keycodes | `jsPsych.ALL_KEYS` | This array contains the keys that the subject is allowed to press in order to respond to the stimulus. Keys can be specified as their [numeric key code](http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes) or as characters (e.g., `'a'`, `'q'`). The default value of `jsPsych.ALL_KEYS` means that all keys will be accepted as valid responses. Specifying `jsPsych.NO_KEYS` will mean that no responses are allowed. +prompt | string | null | This string can contain HTML markup. Any content here will be displayed below the stimulus. The intention is that it can be used to provide a reminder about the action the subject is supposed to take (e.g., which key to press). +stimulus_duration | numeric | null | How long to display the stimulus in milliseconds. The visibility CSS property of the stimulus will be set to `hidden` after this time has elapsed. If this is null, then the stimulus will remain visible until the trial ends. +trial_duration | numeric | null | How long to wait for the subject to make a response before ending the trial in milliseconds. If the subject fails to make a response before this timer is reached, the subject's response will be recorded as null for the trial and the trial will end. If the value of this parameter is null, then the trial will wait for a response indefinitely. +response_ends_trial | boolean | true | If true, then the trial will end whenever the subject makes a response (assuming they make their response before the cutoff specified by the `trial_duration` parameter). If false, then the trial will continue until the value for `trial_duration` is reached. You can use this parameter to force the subject to view a stimulus for a fixed amount of time, even if they respond before the time is complete. + +## Data Generated + +In addition to the [default data collected by all plugins](overview#data-collected-by-plugins), this plugin collects the following data for each trial. + +Name | Type | Value +-----|------|------ +key_press | numeric | Indicates which key the subject pressed. The value is the [numeric key code](http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes) corresponding to the subject's response. +rt | numeric | The response time in milliseconds for the subject to make a response. The time is measured from when the stimulus first appears on the screen until the subject's response. + +Note: the canvas stimulus is *not* included in the trial data because it is a function. Any stimulus information that should be saved in the trial data can be added via the `data` parameter. + +## Examples + +### Displaying a shape until subject gives a response + +```javascript +function drawRect(c){ + var ctx = c.getContext('2d'); + ctx.beginPath(); + ctx.rect(30, 30, 200, 50); + ctx.stroke(); +} + +var trial = { + type: 'canvas-keyboard-response', + stimulus: drawRect, + choices: ['e','i'], + prompt: 'Is this a circle or a rectangle? Press "e" for circle and "i" for rectangle.
', + data: {shape: 'rectangle'} +} +``` + +### Displaying a circle for 1 second, no response allowed + +```javascript +function drawCirc(c){ + var ctx = c.getContext('2d'); + ctx.beginPath(); + ctx.arc(100, 75, 50, 0, 2 * Math.PI); + ctx.stroke(); +} + +var trial = { + type: 'canvas-keyboard-response', + stimulus: drawCirc, + choices: jsPsych.NO_KEYS, + trial_duration: 1000, + data: {shape: 'circle', radius: 50} +} +``` \ No newline at end of file diff --git a/docs/plugins/jspsych-canvas-slider-response.md b/docs/plugins/jspsych-canvas-slider-response.md new file mode 100644 index 00000000..5378ea7c --- /dev/null +++ b/docs/plugins/jspsych-canvas-slider-response.md @@ -0,0 +1,89 @@ +# jspsych-canvas-slider-response + +This plugin can be used to draw a stimulus on a [HTML canvas element](https://www.w3schools.com/html/html5_canvas.asp) and collect a response within a range of values, which is made by dragging a slider. The canvas stimulus can be useful for displaying dynamic, parametrically-defined graphics, and for controlling the positioning of multiple graphical elements (shapes, text, images). The stimulus can be displayed until a response is given, or for a pre-determined amount of time. The trial can be ended automatically if the subject has failed to respond within a fixed length of time. + +## Parameters + +Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. + +Parameter | Type | Default Value | Description +----------|------|---------------|------------ +stimulus | function | *undefined* | The function to draw on the canvas. This function automatically takes a canvas element as its only argument, e.g. `function(c) {...}` or `function drawStim(c) {...}`, where `c` refers to the canvas element. Note that the stimulus function will still generally need to set the correct context itself, using a line like `let ctx = c.getContext("2d")`. +canvas_size | array | [500, 500] | Array that defines the size of the canvas element in pixels. First value is height, second value is width. +labels | array of strings | [] | Labels displayed at equidistant locations on the slider. For example, two labels will be placed at the ends of the slider. Three labels would place two at the ends and one in the middle. Four will place two at the ends, and the other two will be at 33% and 67% of the slider width. +button_label | string | 'Continue' | Label of the button to end the trial. +min | integer | 0 | Sets the minimum value of the slider. +max | integer | 100 | Sets the maximum value of the slider. +slider_start | integer | 50 | Sets the starting value of the slider. +step | integer | 1 | Sets the step of the slider. This is the smallest amount by which the slider can change. +slider_width | integer | null | Set the width of the slider in pixels. If left null, then the width will be equal to the widest element in the display. +require_movement | boolean | false | If true, the subject must click the slider before clicking the continue button. +prompt | string | null | This string can contain HTML markup. Any content here will be displayed below the stimulus. The intention is that it can be used to provide a reminder about the action the subject is supposed to take (e.g., what question to answer). +stimulus_duration | numeric | null | How long to display the stimulus in milliseconds. The visibility CSS property of the stimulus will be set to `hidden` after this time has elapsed. If this is null, then the stimulus will remain visible until the trial ends. +trial_duration | numeric | null | How long to wait for the subject to make a response before ending the trial in milliseconds. If the subject fails to make a response before this timer is reached, the subject's response will be recorded as null for the trial and the trial will end. If the value of this parameter is null, then the trial will wait for a response indefinitely. +response_ends_trial | boolean | true | If true, then the trial will end whenever the subject makes a response (assuming they make their response before the cutoff specified by the `trial_duration` parameter). If false, then the trial will continue until the value for `trial_duration` is reached. You can use this parameter to force the subject to view a stimulus for a fixed amount of time, even if they respond before the time is complete. + +## Data Generated + +In addition to the [default data collected by all plugins](overview#data-collected-by-plugins), this plugin collects the following data for each trial. + +Name | Type | Value +-----|------|------ +response | numeric | The numeric value of the slider. +rt | numeric | The time in milliseconds for the subject to make a response. The time is measured from when the stimulus first appears on the screen until the subject's response. + +Note: the canvas stimulus is *not* included in the trial data because it is a function. Any stimulus information that should be saved in the trial data can be added via the `data` parameter. + +## Examples + +### stimulus function that only takes canvas argument + +```javascript +var colors = [#'FF3333', '#FF6A33']; + +function twoSquares(c) { + var ctx = c.getContext('2d'); + ctx.fillStyle = colors[0]; + ctx.fillRect(200, 70, 40, 40); + ctx.fillStyle = colors[1]; + ctx.fillRect(260, 70, 40, 40); +} + +var trial = { + type: 'canvas-slider-response', + stimulus: twoSquares, + labels: ['0','10'], + canvas_size: [200, 500], + prompt: 'How different would you say the colors of these two squares are on a scale from 0 (the same) to 10 (completely different)
', + data: {color1: colors[0], color2: colors[1]} +} +``` + +### stimulus function that takes additional parameters + +```javascript +var colors; + +function twoSquares(c, colors) { + var ctx = c.getContext('2d'); + ctx.fillStyle = colors[0]; + ctx.fillRect(200, 70, 40, 40); + ctx.fillStyle = colors[1]; + ctx.fillRect(260, 70, 40, 40); +} + +var trial = { + type: 'canvas-slider-response', + stimulus: function(c) { + colors = ['darkred', 'cyan']; + twoSquares(c, colors); + }, + labels: ['ExactlyHow different would you say the colors of these two squares are?
', + on_finish: function(data) { + data.color1 = colors[0]; + data.color2 = colors[1]; + } +}; +``` \ No newline at end of file diff --git a/docs/plugins/jspsych-maxdiff.md b/docs/plugins/jspsych-maxdiff.md new file mode 100644 index 00000000..5f69e834 --- /dev/null +++ b/docs/plugins/jspsych-maxdiff.md @@ -0,0 +1,42 @@ +# jspsych-maxdiff plugin + +The maxdiff plugin displays a table with rows of alternatives to be endorsed, typically as 'most' or 'least' on a particular criteria (e.g. importance, preference, similarity). The participant responds by selecting one radio button corresponding to an alternative in both the left and right response columns. The same alternative cannot be endorsed on both the left and right response columns (e.g. 'most' and 'least') simultaneously. + +## Parameters + +Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. + +Parameter | Type | Default Value | Description +----------|------|---------------|------------ +alternatives | array | *undefined* | An array of one or more alternatives of string type to fill the rows of the maxdiff table. If `required` is true, then the array must contain two or more alternatives, so that at least one can be selected for both the left and right columns. +labels | array | *undefined* | An array with exactly two labels of string type to display as column headings (to the left and right of the alternatives) for responses on the criteria of interest. +randomize_alternative_order | boolean | `false` | If true, the display order of `alternatives` is randomly determined at the start of the trial. +preamble | string | empty string | HTML formatted string to display at the top of the page above the maxdiff table. +required | boolean | `false` | If true, prevents the user from submitting the response and proceeding until a radio button in both the left and right response columns has been selected. +button_label | string | 'Continue' | Label of the button. + + +## Data Generated + +In addition to the [default data collected by all plugins](overview#data-collected-by-plugins), this plugin collects the following data for each trial. + +Name | Type | Value +-----|------|------ +rt | numeric | The response time in milliseconds for the subject to make a response. The time is measured from when the maxdiff table first appears on the screen until the subject's response. +labels | JSON string | A string in JSON format containing the labels corresponding to the left and right response columns. +left | string | The alternative endorsed on the left column. +right | string | The alternative endorsed on the right column. + + +## Examples + +#### Basic example + +```javascript +var maxdiff_page = { + type: 'maxdiff', + alternatives: ['apple', 'orange', 'pear', 'banana'], + labels: ['Most Preferred', 'Least Preferred'], + preamble: 'Please select your most preferred and least preferred fruits.
' +}; +``` \ No newline at end of file diff --git a/docs/plugins/jspsych-video-button-response.md b/docs/plugins/jspsych-video-button-response.md index 5c2a5d7a..ad0d3fa7 100644 --- a/docs/plugins/jspsych-video-button-response.md +++ b/docs/plugins/jspsych-video-button-response.md @@ -24,6 +24,7 @@ rate | numeric | null | The playback rate of the video. 1 is normal, <1 is slowe trial_ends_after_video | bool | false | If true, then the trial will end as soon as the video file finishes playing. trial_duration | numeric | null | How long to wait for the subject to make a response before ending the trial in milliseconds. If the subject fails to make a response before this timer is reached, the subject's response will be recorded as null for the trial and the trial will end. If the value of this parameter is null, then the trial will wait for a response indefinitely. response_ends_trial | boolean | true | If true, then the trial will end whenever the subject makes a response (assuming they make their response before the cutoff specified by the `trial_duration` parameter). If false, then the trial will continue until the value for `trial_duration` is reached. You can set this parameter to `false` to force the subject to view a stimulus for a fixed amount of time, even if they respond before the time is complete. +response_allowed_while_playing | boolean | true | If true, then responses are allowed while the video is playing. If false, then the video must finish playing before the button choices are enabled and a response is accepted. Once the video has played all the way through, the buttons are enabled and a response is allowed (including while the video is being re-played via on-screen playback controls). ## Data Generated diff --git a/docs/plugins/jspsych-video-keyboard-response.md b/docs/plugins/jspsych-video-keyboard-response.md index eaf727e8..5a19f7a4 100644 --- a/docs/plugins/jspsych-video-keyboard-response.md +++ b/docs/plugins/jspsych-video-keyboard-response.md @@ -21,7 +21,7 @@ choices | array of keycodes | `jsPsych.ALL_KEYS` | This array contains the keys trial_ends_after_video | bool | false | If true, then the trial will end as soon as the video file finishes playing. trial_duration | numeric | null | How long to wait for the subject to make a response before ending the trial in milliseconds. If the subject fails to make a response before this timer is reached, the subject's response will be recorded as null for the trial and the trial will end. If the value of this parameter is null, then the trial will wait for a response indefinitely. response_ends_trial | boolean | true | If true, then the trial will end whenever the subject makes a response (assuming they make their response before the cutoff specified by the `trial_duration` parameter). If false, then the trial will continue until the value for `trial_duration` is reached. You can set this parameter to `false` to force the subject to view a stimulus for a fixed amount of time, even if they respond before the time is complete. - +response_allowed_while_playing | boolean | true | If true, then responses are allowed while the video is playing. If false, then the video must finish playing before a keyboard response is accepted. Once the video has played all the way through, a valid keyboard response is allowed (including while the video is being re-played via on-screen playback controls). ## Data Generated diff --git a/docs/plugins/jspsych-video-slider-response.md b/docs/plugins/jspsych-video-slider-response.md index 76dd5cbc..14d56130 100644 --- a/docs/plugins/jspsych-video-slider-response.md +++ b/docs/plugins/jspsych-video-slider-response.md @@ -27,6 +27,7 @@ button_label | string | 'Continue' | Label of the button to end the trial. trial_ends_after_video | bool | false | If true, then the trial will end as soon as the video file finishes playing. trial_duration | numeric | null | How long to wait for the subject to make a response before ending the trial in milliseconds. If the subject fails to make a response before this timer is reached, the subject's response will be recorded as null for the trial and the trial will end. If the value of this parameter is null, then the trial will wait for a response indefinitely. response_ends_trial | boolean | true | If true, then the trial will end whenever the subject makes a response (assuming they make their response before the cutoff specified by the `trial_duration` parameter). If false, then the trial will continue until the value for `trial_duration` is reached. You can set this parameter to `false` to force the subject to view a stimulus for a fixed amount of time, even if they respond before the time is complete. +response_allowed_while_playing | boolean | true | If true, then responses are allowed while the video is playing. If false, then the video must finish playing before the slider is enabled and the trial can end via the next button click. Once the video has played all the way through, the slider is enabled and a response is allowed (including while the video is being re-played via on-screen playback controls). ## Data Generated diff --git a/examples/jspsych-audio-button-response.html b/examples/jspsych-audio-button-response.html index 3e6ac41e..94de8b25 100644 --- a/examples/jspsych-audio-button-response.html +++ b/examples/jspsych-audio-button-response.html @@ -13,9 +13,9 @@ timeline.push({ type: 'html-button-response', - stimulus: 'Recent versions of Chrome require the user to interact with a page before it can play audio. '+ - 'Clicking the button below counts as an interaction. Be aware of this when planning audio experiments if '+ - 'you want the first trial to include audio.', + stimulus: 'Some browsers now require the user to interact with a page before it can play audio. '+ + 'Clicking the button below counts as an interaction.
Be aware of this when planning audio experiments if '+ + 'you want the first trial to include audio.
What word was said? (trial ends after 2s)
" }); + timeline.push({ + type: 'audio-button-response', + stimulus: 'sound/speech_joke.mp3', + choices: ['Not funny', 'Funny'], + prompt: 'How funny was the joke?
When the audio stops, click a button to end the trial.
Response buttons are disabled while the audio is playing.
', + response_allowed_while_playing: false + }) + jsPsych.init({ timeline: timeline, use_webaudio: false, diff --git a/examples/jspsych-audio-keyboard-response.html b/examples/jspsych-audio-keyboard-response.html index 990982ce..be0fb941 100644 --- a/examples/jspsych-audio-keyboard-response.html +++ b/examples/jspsych-audio-keyboard-response.html @@ -11,9 +11,9 @@ var pre_audio = { type: 'html-button-response', - stimulus: 'Recent versions of Chrome require the user to interact with a page before it can play audio. '+ - 'Clicking the button below counts as an interaction. Be aware of this when planning audio experiments if '+ - 'you want the first trial to include audio.', + stimulus: 'Some browsers now require the user to interact with a page before it can play audio. '+ + 'Clicking the button below counts as an interaction.
Be aware of this when planning audio experiments if '+ + 'you want the first trial to include audio.
No response allowed. 2s wait.
' } + trial_4 = { + type: 'audio-keyboard-response', + stimulus: 'sound/speech_joke.mp3', + choices: jsPsych.ALL_KEYS, + prompt: 'When the audio stops, press any key to end the trial.
Responses made while the audio is still playing will be ignored.
', + response_allowed_while_playing: false + } + jsPsych.init({ - timeline: [pre_audio, trial_1, trial_2, trial_3], + timeline: [pre_audio, trial_1, trial_2, trial_3, trial_4], use_webaudio: false, on_finish: function() { jsPsych.data.displayData(); diff --git a/examples/jspsych-audio-slider-response.html b/examples/jspsych-audio-slider-response.html index cb0b79ab..d35f9f34 100644 --- a/examples/jspsych-audio-slider-response.html +++ b/examples/jspsych-audio-slider-response.html @@ -11,9 +11,9 @@ var pre_audio = { type: 'html-button-response', - stimulus: 'Recent versions of Chrome require the user to interact with a page before it can play audio. '+ - 'Clicking the button below counts as an interaction. Be aware of this when planning audio experiments if '+ - 'you want the first trial to include audio.', + stimulus: 'Some browsers now require the user to interact with a page before it can play audio. '+ + 'Clicking the button below counts as an interaction.
Be aware of this when planning audio experiments if '+ + 'you want the first trial to include audio.
How funny is the joke?
' } + var trial_2 = { + type: 'audio-slider-response', + stimulus: 'sound/speech_red.mp3', + labels: ['Hate it', 'It"s OK', 'Love it'], + slider_width: 500, + prompt: 'How much do you like this color?
Slider movement is required, so you must interact with (click) the slider before you can continue.
', + require_movement: true + } + + var trial_3 = { + type: 'audio-slider-response', + stimulus: 'sound/hammer.mp3', + labels: ['Unpleasant', 'OK', 'Very pleasant'], + slider_width: 500, + prompt: 'How pleasant was this sound?
The slider will be enabled after the audio ends.
', + response_allowed_while_playing: false + } + jsPsych.init({ - timeline: [pre_audio, trial_1], + timeline: [pre_audio, trial_1, trial_2, trial_3], use_webaudio: false, on_finish: function() { jsPsych.data.displayData(); diff --git a/examples/jspsych-canvas-button-response.html b/examples/jspsych-canvas-button-response.html new file mode 100644 index 00000000..29940bae --- /dev/null +++ b/examples/jspsych-canvas-button-response.html @@ -0,0 +1,95 @@ + + + + + + + + + + \ No newline at end of file diff --git a/examples/jspsych-canvas-keyboard-response.html b/examples/jspsych-canvas-keyboard-response.html new file mode 100644 index 00000000..d12b4828 --- /dev/null +++ b/examples/jspsych-canvas-keyboard-response.html @@ -0,0 +1,78 @@ + + + + + + + + + + \ No newline at end of file diff --git a/examples/jspsych-canvas-slider-response.html b/examples/jspsych-canvas-slider-response.html new file mode 100644 index 00000000..5ae17a67 --- /dev/null +++ b/examples/jspsych-canvas-slider-response.html @@ -0,0 +1,67 @@ + + + + + + + + + + \ No newline at end of file diff --git a/examples/jspsych-maxdiff.html b/examples/jspsych-maxdiff.html new file mode 100644 index 00000000..7a87c0e6 --- /dev/null +++ b/examples/jspsych-maxdiff.html @@ -0,0 +1,33 @@ + + + + + + + + + + \ No newline at end of file diff --git a/examples/jspsych-video-button-response.html b/examples/jspsych-video-button-response.html index b62378b5..decb9f53 100644 --- a/examples/jspsych-video-button-response.html +++ b/examples/jspsych-video-button-response.html @@ -12,10 +12,10 @@ var pre_trial = { type: 'html-button-response', stimulus: 'Some browsers now require that a user interacts with a web page before video or audio content will autoplay. Clicking the button below satisfies that requirement.
Without this trial, the video will load but not play.
How great was the video?
When the video stops, click a button to end the trial.
Response buttons are disabled while the video is playing.
', + width: 600, + autoplay: true, + response_ends_trial: true, + response_allowed_while_playing: false + } + jsPsych.init({ show_preload_progress_bar: true, - timeline: [pre_trial, trial], + timeline: [pre_trial, trial_1, trial_2], on_finish: function() { jsPsych.data.displayData(); } }); diff --git a/examples/jspsych-video-keyboard-response.html b/examples/jspsych-video-keyboard-response.html index e5ee8f27..19f589dd 100644 --- a/examples/jspsych-video-keyboard-response.html +++ b/examples/jspsych-video-keyboard-response.html @@ -15,7 +15,7 @@ choices: ['continue'] } - var trial = { + var trial_1 = { type: 'video-keyboard-response', sources: ['video/sample_video.mp4'], choices: ['y','n'], @@ -24,20 +24,30 @@ //height: 600, autoplay: true, //controls: true, - start: 8.75, - stop: 9, + //start: 8, + //stop: 9, rate: 1.5, //trial_duration: 2000, //trial_ends_after_video: true, response_ends_trial: true } - jsPsych.init({ + var trial_2 = { + type: 'video-keyboard-response', + sources: ['video/sample_video.mp4'], + choices: jsPsych.ALL_KEYS, + prompt: 'When the video stops, press any key to end the trial.
Responses that are made before the video ends will be ignored.
', + width: 600, + autoplay: true, + response_ends_trial: true, + response_allowed_while_playing: false + } + jsPsych.init({ show_preload_progress_bar: true, - timeline: [pre_trial, trial], + timeline: [pre_trial, trial_1, trial_2], on_finish: function() { jsPsych.data.displayData(); } }); -