randomizing multiple objects stored in a list.js

63 Views Asked by At

Been bashing my head over this for a while. The project I'm working on requires that I display two randomly selected videos from a list of four possible, unique animations, and on the next page, display the correct corresponding textual description for the video selected. Right now, the approach I'm taking is creating a separate list.js file apart from my code, with each video grouped with its corresponding sentence, but as my code is right now, I cannot use the randomization function to randomize all objects at once.

the list.js file.

//two randomly selected animations are shown here as samples
var stims = jsPsych.randomization.factorial(list.js)
  for (const i of stims) {
    var video = "video/" + i[video] + ".mp4"
    var description = {
      type: "html-keyboard-response",
      stimulus: [
        i["sentence"] + 
        "<p> Press spacebar to proceed to the next sample animation </p>"
      ],
      choices: [' ']
    }
    var experience = {
      timeline:
      [
        {
          type: 'video',
          width: 600,
          data: {
            subject: code,
          },
          sources: [video]
        }
      ]
    }

  timeline.push(fixation);
  timeline.push(experience);
  timeline.push(description);
  }

above is the pertinent code in my experiment.

0

There are 0 best solutions below