mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-13 00:58:12 +00:00
70 lines
2.3 KiB
HTML
70 lines
2.3 KiB
HTML
<!doctype html>
|
|
<html>
|
|
|
|
<head>
|
|
<title>jspsych-vsl-animate-occlusion plugin example</title>
|
|
<!-- jQuery -->
|
|
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
|
<script src="scripts/raphael-min.js"></script>
|
|
<!-- jsPsych -->
|
|
<script src="scripts/jspsych.js"></script>
|
|
<script src="scripts/plugins/jspsych-vsl-animate-occlusion.js"></script>
|
|
<!-- style -->
|
|
<style>
|
|
#jspsych_target {
|
|
margin: 50px auto 50px auto;
|
|
width: 600px;
|
|
font-size:18px;
|
|
text-align: center;
|
|
}
|
|
pre {
|
|
text-align: left;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<div id="jspsych_target"></div>
|
|
</body>
|
|
<script type="text/javascript">
|
|
var images = ["img/1.gif","img/2.gif","img/3.gif","img/4.gif","img/5.gif",
|
|
"img/6.gif","img/7.gif","img/8.gif","img/9.gif","img/10.gif"];
|
|
|
|
|
|
// create vsl block for jspsych
|
|
var vsl_block = {
|
|
type: 'vsl-animate-occlusion',
|
|
stimuli: images
|
|
};
|
|
|
|
// preload images
|
|
// call start() when loading is complete
|
|
jsPsych.preloadImages(images, start);
|
|
|
|
// function to launch jspsych experiment
|
|
// putting this in a function so that it only gets called once all the
|
|
// images are loaded using preloadImages
|
|
function start() {
|
|
jsPsych.init({
|
|
display_element: $('#jspsych_target'),
|
|
experiment_structure: [vsl_block],
|
|
on_finish: function(data) {
|
|
$('#jspsych_target').append($("<pre>", {
|
|
html: JSON.stringify(data, undefined, 2)
|
|
}));
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
<script>
|
|
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
|
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
|
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
|
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
|
|
|
ga('create', 'UA-50563838-1', 'jspsych.org');
|
|
ga('send', 'pageview');
|
|
|
|
</script>
|
|
|
|
</html> |