jsPsych/docs/plugins/demos/jspsych-animation-demo.html

50 lines
1.7 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/gh/jspsych/jsPsych@6.3.1/jspsych.js"></script>
<script src="https://cdn.jsdelivr.net/gh/jspsych/jsPsych@6.3.1/plugins/jspsych-animation.js"></script>
<script src="https://cdn.jsdelivr.net/gh/jspsych/jsPsych@6.3.1/plugins/jspsych-preload.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/jspsych/jsPsych@6.3.1/css/jspsych.css">
</head>
<body></body>
<script>
var preload_trial = {
type: 'preload',
auto_preload: true
}
// If render_on_canvas is false, the images will be shown via an <img> rather than <canvas> element.
// In some browsers, the first time the images are shown, the <img> method (render_on_canvas: false) will produce a brief
// blank screen (white flash) between images when frame_isi is 0.
var animation_trial = {
type: 'animation',
stimuli: [
'https://cdn.jsdelivr.net/gh/jspsych/jsPsych@6.3.1/examples/img/happy_face_1.jpg',
'https://cdn.jsdelivr.net/gh/jspsych/jsPsych@6.3.1/examples/img/happy_face_2.jpg',
'https://cdn.jsdelivr.net/gh/jspsych/jsPsych@6.3.1/examples/img/happy_face_3.jpg',
'https://cdn.jsdelivr.net/gh/jspsych/jsPsych@6.3.1/examples/img/happy_face_4.jpg'
],
sequence_reps: 3,
frame_time: 300,
prompt: '<p>Watch the faces.</p>',
//render_on_canvas: false
};
if (typeof jsPsych !== "undefined") {
jsPsych.init({
timeline: [preload_trial, animation_trial],
on_finish: function() {
jsPsych.data.displayData();
}
});
} else {
document.body.innerHTML = '<div style="text-align:center; margin-top:50%; transform:translate(0,-50%);">You must be online to view the plugin demo.</div>';
}
</script>
</html>