Skip to content

Commit

Permalink
Update documents
Browse files Browse the repository at this point in the history
  • Loading branch information
kurokida committed Jan 5, 2022
1 parent be918ff commit 6395c4f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
2 changes: 2 additions & 0 deletions docs/_pages/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ Yes. See the [demos/localize-circle.html](https://www.hes.kyushu-u.ac.jp/~kuroki

Yes. See the [demos/mouse_drawing.html](https://www.hes.kyushu-u.ac.jp/~kurokid/jspsychophysics/demos/mouse_drawing.html), [demos/mouse_event.html](https://www.hes.kyushu-u.ac.jp/~kurokid/jspsychophysics/demos/mouse_event.html), and the [demos/keyboard_event.html](https://www.hes.kyushu-u.ac.jp/~kurokid/jspsychophysics/demos/keyboard_event.html). The mousedown, mouseup, and mousemove on the canvas and the keydown and keyup on the document are supported.

However, there are cases where it is better not to use these event handlers. See [this issue](https://github.com/kurokida/jspsych-psychophysics/issues/27).

## 8. The jsPsych.timelineVariable function which specified in a stimulus object does not work properly.

See the [demos/how_to_timeline_variables.html](https://www.hes.kyushu-u.ac.jp/~kurokid/jspsychophysics/demos/how_to_timeline_variables.html) and [demos/response_start_time_depends_on_onsets.html](https://www.hes.kyushu-u.ac.jp/~kurokid/jspsychophysics/demos/response_start_time_depends_on_onsets.html)
Expand Down
10 changes: 5 additions & 5 deletions docs/_pages/pluginParams.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ In addition to the [default data collected by all plugins](https://www.jspsych.o

|Parameter|Description|
|---|---|
|canvas|You can access the element of the canvas via the `jsPsych.currentTrial().canvas`.|
|context|You can access the context of the canvas via the `jsPsych.currentTrial().context`.|
|centerX|You can access the horizontal center of the canvas via the `jsPsych.currentTrial().centerX`.|
|centerY|You can access the vertical center of the canvas via the `jsPsych.currentTrial().centerY`.|
|stim_array|You can access the stimuli via the `jsPsych.currentTrial().stim_array`.|
|canvas|You can access the element of the canvas via the `jsPsych.getCurrentTrial().canvas`.|
|context|You can access the context of the canvas via the `jsPsych.getCurrentTrial().context`.|
|centerX|You can access the horizontal center of the canvas via the `jsPsych.getCurrentTrial().centerX`.|
|centerY|You can access the vertical center of the canvas via the `jsPsych.getCurrentTrial().centerY`.|
|stim_array|You can access the stimuli via the `jsPsych.getCurrentTrial().stim_array`.|
29 changes: 16 additions & 13 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ The jspsych-psychophysics plugin is developed for the purpose of conducting onli
This plugin can be used free of charge under the MIT license.

## What you can do with the jspsych-psychophysics plugin
- You can present multiple stimuli asynchronously, that is, you can set stimulus onset asynchronies (SOAs) in a trial.
- You can present visual stimuli (e.g., [gabor patches](/gabor/), images, lines, rectangles, circles, and texts) at intended coordinates, and the time duration can be specified in terms of milliseconds and frames. You can also move these stimuli, and play sound files.
- You can present multiple stimuli asynchronously. In other words, you can set stimulus onset asynchronies (SOAs) in a single trial.
- You can present visual stimuli (e.g., [gabor patches](/gabor/), images, lines, rectangles, circles, and texts) at intended coordinates, and the time duration can be specified in terms of both milliseconds and frames. You can also move these stimuli, and play sound files.
- This plugin presents visual stimuli synchronized with the refresh of the display using the **requestAnimationFrame** method. According to my observation, the SOA between visual stimuli with the plugin was more accurate than that without the plugin ([Kuroki, 2020](https://rdcu.be/b5Nie)).
- You can specify the mouse/keyboard event handler. For example, you can make a program in which a participant change the luminance of a stimulus pressing the ArrowUp/ArrowDown key, and finish the trial pressing the space key. See [the FAQ 7](/faq/).
- Participants' responses can be captured using the keyboard, mouse or buttons. The position of the mouse click can be recorded as a response.
Expand Down Expand Up @@ -65,7 +65,7 @@ var circle_object = {
}
```

The origin of the coordinate is the top left of the canvas, but the origin can be changed to the center of the window (canvas) by specifying the `origin_center` property as true. The unit is the pixel.
The default origin of the coordinate is the top left of the canvas, but the origin can be changed to the center of the window (canvas) by specifying the `origin_center` property as true. The unit is the pixel.

The color can be specified using the HTML color names, hexadecimal (HEX) colors, and RGB values that are often used in a general HTML file.

Expand All @@ -74,28 +74,31 @@ The **show_start_time** property is one of the most notable properties, which en
### 4. Specify a trial object including all the stimuli in the jsPsych's timeline

```javascript
var trial = {
type: 'psychophysics',

const jsPsych = initJsPsych()

const trial = {
type: jsPsychPsychophysics,
stimuli: [rect_object, circle_object],
choices: ['y', 'n'], // The participant can respond to the stimuli using the 'y' or 'n' key.
canvas_width: 1000,
canvas_height: 800,
background_color: '#008000', // The HEX color means green.
}

jsPsych.init({
timeline: [trial],
on_finish: function(){jsPsych.data.displayData();}
});
jsPsych.run([trial])

```

The **stimuli** property must include all the objects to be presented in the trial.
Note that since jsPsych V7, you need to specify type: jsPsychPsychophysics.

The **stimuli** array must include all the stimulus objects to be presented in the trial.

This trial object must be included as the **timeline** property of the jsPsych.init which is a core function of the jsPsych.
This trial object must be passed as an argument to the `jsPsych.run` function.

Note that if you use image and audio files in a trial, please preload them using the preload_images and preload_audio methods in the jsPsych.init. See, [demos/randomizedImages.html](https://www.hes.kyushu-u.ac.jp/~kurokid/jspsychophysics/demos/randomizedImages.html) and [demos/twoSoundsWithSOA.html](https://www.hes.kyushu-u.ac.jp/~kurokid/jspsychophysics/demos/twoSoundsWithSOA.html).
If you use image and audio files in a trial, please preload them at the begging of the program using [the preload plugin](https://www.jspsych.org/7.1/plugins/preload/). See, [demos/randomizedImages.html](https://www.hes.kyushu-u.ac.jp/~kurokid/jspsychophysics/demos/randomizedImages.html) and [demos/twoSoundsWithSOA.html](https://www.hes.kyushu-u.ac.jp/~kurokid/jspsychophysics/demos/twoSoundsWithSOA.html).

In addition, the other applications and the tabs in a web browser should be closed during the experiment. This should be informed as an instruction at the begging of the experiment.
The other applications and the tabs in a web browser should be closed during the experiment. This should be informed as an instruction at the begging of the experiment.

## Demonstrations
[The jspsych-psychophysics package includes a lot of demonstration files.](/demo_explanation/)
Expand Down

0 comments on commit 6395c4f

Please sign in to comment.