Skip to content
Discussion options

You must be logged in to vote

Hi Cai,

I made a demo of this: https://hrkpo8wcrs.cognition.run/

Here's the source code:

var before_audio = {
  type: 'html-button-response',
  stimulus: 'Click to start',
  choices: ['OK']
}

var audio = null;

var start_audio = {
  type: 'call-function',
  func: function(){
    audio = new Audio();
    audio.src = "drum-loop.mp3";
    audio.loop = true;
    audio.play();
  }
}

var in_between_trials = {
  timeline: [{
    type: 'html-button-response',
    stimulus: function(){
      return `<p>Intermediate trial ${jsPsych.timelineVariable('number')} of 4</p>`
    },
    choices: ['Next']
  }],
  timeline_variables: [
    {number: 1},
    {number: 2},
    {number: 3},
    {number: 4}
  ]
}

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@cslongman
Comment options

@cslongman
Comment options

Answer selected by cslongman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants