Skip to content

Commit

Permalink
Updated documents
Browse files Browse the repository at this point in the history
  • Loading branch information
kurokida committed Jun 28, 2024
1 parent 5ab31a0 commit 4e95bde
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/_pages/pixijs.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: "Psychophysics plugin with PixiJS"

Starting with version 3.2.0, the psychophysics plugin can present visual stimuli using [PixiJS](https://pixijs.com/) functionality. You can turn on and off Pixi mode, but if you present drifting gabor patches Pixi mode should be turned on.

If you are interested in Pixi mode, please see [the results of an accuracy test conducted in April 2022](https://www.hes.kyushu-u.ac.jp/~kurokid/PixiJS_test/AccuracyTest202204/histogram20220421.html) at first. I obtained good results in total, but I am a little concerned about Firefox. Note that I have only checked one laptop.
If you are interested in Pixi mode, please see [the results of an accuracy test conducted in June 2024](https://osf.io/pj4sb/wiki/Accuracy%20test%20June%202024/) at first.

# How to turn on Pixi mode

Expand Down Expand Up @@ -48,14 +48,14 @@ const trial = {

- There may be a way to enable anti-aliasing, but I have yet to find it. You can clearly see the difference between anti-aliasing [on](https://www.hes.kyushu-u.ac.jp/~kurokid/PixiJS_test/psychophysics-demos/dynamically_change.html?pixi_flag=0) and [off](https://www.hes.kyushu-u.ac.jp/~kurokid/PixiJS_test/psychophysics-demos/dynamically_change.html?pixi_flag=1).
- You may feel a flash of screen immediately after the trial when the background color is not white. In this case, you can avoid the problem by writing as `<body bgcolor="gray"></body>`.
- The quality of text seems to be better in non Pixi mode. For example, [Pixi mode](https://www.hes.kyushu-u.ac.jp/~kurokid/PixiJS_test/psychophysics-demos/mask_filter_with_label.html?pixi_flag=1) and [Non Pixi mode](https://www.hes.kyushu-u.ac.jp/~kurokid/PixiJS_test/psychophysics-demos/mask_filter_with_label.html?pixi_flag=0)
- The quality of text seems to be better in non Pixi mode. For example, [Pixi mode](https://www.hes.kyushu-u.ac.jp/~kurokid/jspsychophysics/demos/mask_filter_with_label.html?pixi_flag=1) and [Non Pixi mode](https://www.hes.kyushu-u.ac.jp/~kurokid/jspsychophysics/demos/mask_filter_with_label.html?pixi_flag=0)

So, please switch between Pixi modes depending on the purpose of the experiment.

# Advanced usage

Using the PixiJS application's ticker, you can change attributes of the stimulus. See the "Writing an Update Loop" section in [the PixiJS guides](https://pixijs.io/guides/basics/getting-started.html). To do the same thing in the psychophysics plugin, use the change_attr function. See [demos/change_attributes.html](https://github.com/kurokida/jspsych-psychophysics/blob/master/psychophysics-demos/change_attributes.html) and [demos/elapsed_time_frame_pixi.html](https://github.com/kurokida/jspsych-psychophysics/blob/master/psychophysics-demos/elapsed_time_frame_pixi.html).

If you are familiar with PixiJS, you can make the PixiJS instances and include them in the stimuli property of the psychophysics plugin. See the demos/draw_part_of_image_pixi.html.
If you are familiar with PixiJS, you can make the PixiJS instances and include them in the stimuli property of the psychophysics plugin. See the [demos/draw_part_of_image_pixi.html](https://github.com/kurokida/jspsych-psychophysics/blob/master/psychophysics-demos/draw_part_of_image_pixi.html).

<You can change uniforms.>
16 changes: 16 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,22 @@ The color can be specified using the HTML color names, hexadecimal (HEX) colors,

The **show_start_time** property is one of the most notable properties, which enables to present the stimulus at the intended time. In this example, a white rectangle is presented 500 ms after beginning this trial, after another 500 ms, a red circle is presented until the response.

If you mind the increase/decrease by 1 frame (16.7 ms) regarding visual stimuli, presentation times should be specified in terms of frames not milliseconds. See [my recent observation (June 2024)](https://osf.io/pj4sb/wiki/Accuracy%20test%20June%202024/).

You can specify the time in frames as follows:

```javascript
const rectangle = {
obj_type: 'rect',
width: 100,
height: 100,
fill_color: 'white',
show_start_frame: 0,
show_end_frame: 3, // The rectangle is presented for 3 frames (50 ms).
is_frame: true, // Be careful, it's easy to forget. This is necessary for each stimulus.
}
```

### 4. Specify a trial object including all the stimuli in the jsPsych's timeline

```javascript
Expand Down

0 comments on commit 4e95bde

Please sign in to comment.