Side-by-side comparison
Show two images left and right of centre and let the participant click their choice, scored correctly whichever side the target lands on.
When to use it
Section titled “When to use it”Two-alternative forced choice with images: the participant sees a pair and clicks the one matching some criterion. The naive layout, two stimuli in the default centred row, works but leaves the target on a predictable side, and scoring by screen position breaks the moment you shuffle. This setup positions the pair explicitly, randomises which side the target appears on, and scores by stimulus identity so the shuffle never touches the scoring. Reach for buttons instead when the choice is a judgement about a single stimulus rather than a click on one of two.
Trial file
Section titled “Trial file”| type | content | stimFormat | stim1 | stim2 | stimPos | stimOptions | key | button1 |
|---|---|---|---|---|---|---|---|---|
| instructions | Two photos appear side by side. Click the one taken during the day. | NEXT | ||||||
| test | .jpg | day1 | night1 | -250 0;250 0 | random | stim1 | ||
| test | .jpg | day2 | night2 | -250 0;250 0 | random | stim1 | ||
| test | .jpg | day3 | night3 | -250 0;250 0 | random | stim1 | ||
| test | .jpg | day4 | night4 | -250 0;250 0 | random | stim1 |
type,content,stimFormat,stim1,stim2,stimPos,stimOptions,key,button1 instructions,Two photos appear side by side. Click the one taken during the day.,,,,,,,NEXT test,,.jpg,day1,night1,-250 0;250 0,random,stim1, test,,.jpg,day2,night2,-250 0;250 0,random,stim1, test,,.jpg,day3,night3,-250 0;250 0,random,stim1, test,,.jpg,day4,night4,-250 0;250 0,random,stim1,
How it works
Section titled “How it works”Each test row loads two images: stim1 is always the daytime target, stim2 the night-time foil, with the .jpg extension supplied by stimFormat.
stimPos places them: one segment per stimulus, semicolon-separated, each an X Y pixel offset from the canvas centre. -250 0 puts the first display slot 250 px left of centre, 250 0 puts the second 250 px right. On image trials the offsets scale with the participant’s screen size, so the arrangement holds across devices. Always start the cell with a real position: a leading empty segment leaves the first stimulus in the automatic layout, uncentred against its positioned partner.
stimOptions: random shuffles which stimulus occupies each positioned slot. Positions belong to the slots, not the stimuli, so the layout stays put while the target lands left or right at random on every presentation. The order actually shown is saved per trial in the stimOrder_actual results column.
Clicking is the response without any column asking for it: on test trials with both keyboard and button1 empty, the images themselves become clickable. A click records the stimulus number as the response and ends the trial; the clicked file’s name is saved separately as responseText but is not used for scoring.
key: stim1 is what makes the shuffle safe. A stimulus-based key follows the stimulus through stimOptions: random, so clicking the daytime photo scores correct (correct = 1) wherever it appears. Scoring by position (key: 1) would instead mark “clicked whatever was loaded first”, which is exactly the bug this recipe avoids.
With no presTime, both photos stay up until the click, and the response window opens when they appear, so RT is time from pair onset to choice.
Variations
Section titled “Variations”- Add a deadline with
responseWindowset to3000; no click within 3 s recordstimeoutand auto-advances. - Limit exposure with
presTimeset to1500; the pair disappears after 1.5 s while clicks stay open, separating perception from decision. - Widen the gap by increasing the offsets in
stimPos, or stack the pair vertically with0 -200;0 200. - Jitter the exact positions per presentation with intervals in
stimPos, for example-300_-200 0;200_300 0; the resolved offsets are saved instimPos_actual.