mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 19:20:55 +00:00
update grid-scene docs and demo
This commit is contained in:
parent
3c6f9a445a
commit
09ad9296c4
@ -30,17 +30,17 @@ The plugin also includes a public method for generating the grid scene stimuli t
|
|||||||
```javascript
|
```javascript
|
||||||
|
|
||||||
var pattern = [
|
var pattern = [
|
||||||
["img/1.gif", "img/2.gif", 0],
|
["img/1.gif", "img/2.gif", 0],
|
||||||
[ 0, "img/3.gif", 0],
|
[ 0, "img/3.gif", 0],
|
||||||
["img/5.gif", "img/4.gif", 0]
|
["img/5.gif", "img/4.gif", 0]
|
||||||
];
|
];
|
||||||
|
|
||||||
var image_size = 100; // pixels
|
var image_size = 100; // pixels
|
||||||
|
|
||||||
var grid_stimulus = jsPsych['vsl-grid-scene'].generate_stimulus(pattern, image_size);
|
var grid_stimulus = jsPsych.plugins['vsl-grid-scene'].generate_stimulus(pattern, image_size);
|
||||||
|
|
||||||
// grid_stimulus will now contain a string (NOT an HTML DOM object) that you can
|
// grid_stimulus will now contain a string (NOT an HTML DOM object) that you can
|
||||||
// pass into other plugins that accept HTML stimuli as input, such as jspsych-categorize.
|
// pass into other plugins that accept HTML stimuli as input, such as jspsych-html-keyboard-response.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
|
||||||
<script src="js/snap.svg-min.js"></script>
|
|
||||||
<script src="../jspsych.js"></script>
|
<script src="../jspsych.js"></script>
|
||||||
<script src="../plugins/jspsych-vsl-grid-scene.js"></script>
|
<script src="../plugins/jspsych-vsl-grid-scene.js"></script>
|
||||||
|
<script src="../plugins/jspsych-html-keyboard-response.js"></script>
|
||||||
<link rel="stylesheet" href="../css/jspsych.css"></link>
|
<link rel="stylesheet" href="../css/jspsych.css"></link>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@ -22,14 +21,19 @@
|
|||||||
]
|
]
|
||||||
;
|
;
|
||||||
|
|
||||||
var block = {
|
var trial = {
|
||||||
type: 'vsl-grid-scene',
|
type: 'vsl-grid-scene',
|
||||||
stimuli: scene,
|
stimuli: scene,
|
||||||
image_size: [50,50]
|
image_size: [50,50]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var trial_2 = {
|
||||||
|
type: 'html-keyboard-response',
|
||||||
|
stimulus: jsPsych.plugins['vsl-grid-scene'].generate_stimulus(scene, [100,100])
|
||||||
|
}
|
||||||
|
|
||||||
jsPsych.init({
|
jsPsych.init({
|
||||||
timeline: [block],
|
timeline: [trial, trial_2],
|
||||||
on_finish: function() { jsPsych.data.displayData(); }
|
on_finish: function() { jsPsych.data.displayData(); }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user