randomizing the color of the text?

PennController for IBEX Forums Support randomizing the color of the text?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #6258
    victorialiu05
    Participant

    I’m trying to implement an emotional Stroop effect experiment using PCI bex. This experiment requires me to randomize the colours (blue, red, green, purple) of each word presented to the participants. How can this randomization be implemented?

    #6261
    Jeremy
    Keymaster

    Hi,

    If you are fine with total randomization, you can do something like this:

    newTrial(
      newButton(['blue','red','green','purple'][Math.floor(Math.random()*4)])
        .css("color", ['blue','red','green','purple'][Math.floor(Math.random()*4)])
        .print()
        .wait()
    )

    Another option is to use pseudo-randomization by listing pre-generated color associations in a table and simply refer to the columns from inside Template

    Jeremy

    #6264
    victorialiu05
    Participant

    Thank you Jeremy!!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.