mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-11 16:18:11 +00:00
59 lines
2.0 KiB
HTML
59 lines
2.0 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<script src="../jspsych.js"></script>
|
|
<script src="../plugins/jspsych-rdk.js"></script>
|
|
<link rel="stylesheet" href="../css/jspsych.css">
|
|
</head>
|
|
<body></body>
|
|
<script>
|
|
|
|
/*
|
|
We would appreciate it if you cited this paper when you use the RDK:
|
|
Rajananda, S., Lau, H. & Odegaard, B., (2018). A Random-Dot Kinematogram for Web-Based Vision Research. Journal of Open Research Software. 6(1), p.6. DOI: [http://doi.org/10.5334/jors.194]
|
|
*/
|
|
|
|
|
|
//---------Create trials---------
|
|
|
|
//Create an array of 2 different trials (different conditions)
|
|
var RDK_trials = [
|
|
{//Condition 1
|
|
correct_choice: 'a', //The correct answer for Condition 1
|
|
coherent_direction: 180 //The coherent direction for Condition 1 (dots move left)
|
|
},
|
|
{//Condition 2
|
|
correct_choice: 'l', //The correct answer for Condition 2
|
|
coherent_direction: 0 //The coherent direction for Condition 2 (dots move right)
|
|
},
|
|
];
|
|
|
|
//The test block where all the trials are nested. The properties here will trickle down to all trials in the timeline unless they have their own properties defined
|
|
var test_block = {
|
|
type: "rdk",
|
|
post_trial_gap: 500, //The Inter Trial Interval. You can either have no ITI, or have an ITI but change the display element to be the same color as the stimuli background to prevent flashing between trials
|
|
number_of_dots: 200, //Total number of dots in each aperture
|
|
RDK_type: 3, //The type of RDK used
|
|
choices: ['a', 'l'], //Choices available to be keyed in by participant
|
|
trial_duration: 1000, //Duration of each trial in ms
|
|
timeline: RDK_trials, //The timeline of all the trials
|
|
background_color: "white",
|
|
dot_color: "black"
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------Run the experiment---------
|
|
|
|
//Initiate the experiment
|
|
jsPsych.init({
|
|
timeline: [test_block],
|
|
on_finish: function(){ //Execute this when the experiment finishes
|
|
jsPsych.data.displayData(); //Display the data onto the browser screen
|
|
}
|
|
});
|
|
|
|
</script>
|
|
</html>
|