Skip to content

Text Stimulus

A text stimulus displays a block of text.

Required Properties

type

  • Definition: The type of stimulus (text, audio, image, etc.)
  • Possible values: For a text stimulus, type must be specified as "text".
{
  "type": "text",
  "content": "The text in these quotation marks will be displayed."
}

content

  • Definition: The content to be displayed
  • Possible values: A string of text (strings are any text enclosed in quotation marks " "). If you'd like to add formatting to your string, the following HTML tags are supported: <abbr>, <acronym>, <b>, <blockquote>, <code>, <em>, <i>, <li>, <ol>, <strong>, <ul>, <p>.
{
  "type": "text",
  "content": "The text in these quotation marks will be displayed."
}

Optional Properties

alignment

  • Definition: Where the text will appear on the screen
  • Possible values: "left", "right" and "center"
  • Default: "left"
{
  "type": "text",
  "content": "The text in these quotation marks will be displayed.",
  "alignment": "right"
}

barrier

  • Definition: If set to 'true', a duration property must also be specified, and the stimulus will prevent all other subsequent stimuli and responses from appearing on the trial until the specified duration is over.
  • Possible values: true or false
  • Default: false

{
  "type": "text",
  "content": "This is a text sample",
  "barrier": false // the default; safe to omit
}
In trials using the above stimulus code, other stimuli and responses will be displayed at the same time as the text is displayed. This is the default, and you can omit the last line to achieve the same effect.


{
  "type": "text",
  "content": "This is a text sample",
  "barrier": true,
  "duration": 10
}
In trials using the above stimulus code, the text will be displayed for 10 seconds before other stimuli and responses are displayed.

color

  • Definition: The color of the stimulus
  • Possible values: Common color names such as "red", "darkgreen", or hex codes like "#FF6600"
  • Default: "black"
{
  "type": "text",
  "content": "The text in these quotation marks will be displayed.",
  "color": "#FF6600"
}

delay

Info

This property is used for presenting multiple stimuli on a trial in a sequence. To implement inter-trial intervals, see the delay parameter in trial templates instead.

Warning

The delaying of multiple stimuli on a trial does NOT have a chain effect. That is, the delay of any stimulus on a trial is always relative to the onset of that trial or the end of the last stimulus acting as a barrier.

  • Definition: Delay the onset of a stimulus by a certain number of seconds, relative to (1) the onset of a trial if there are no stimuli acting as barriers or (2) the end of the last stimulus acting as a barrier.
  • Possible values: A number in seconds (decimals are supported)
  • Default: 0 (no delay)

{
  "type": "text",
  "content": "The text in these quotation marks will be displayed.",
  "delay": 1.2
}
The above code introduces a delay of 1200 milliseconds.

duration

  • Definition: Keep a stimulus visible for a certain number of seconds relative to the onset of that stimulus.
  • Possible values: A number of seconds (decimals are supported)
  • Default: -1, meaning that the stimulus, once triggered, will stay on a trial indefinitely
  • In most cases, it is far more common to manipulate the duration of a trial instead. This feature is generally intended to hide a certain stimulus on a trial with multiple stimuli.

{
  "type": "text",
  "content": "The text in these quotation marks will be displayed.",
  "duration": 3
}
The above code renders the text stimulus visible for 3000 milliseconds after the onset of the stimulus.

parent

  • Definition: If specified, then the properties of the specified stimulus will be inherited by this stimulus, unless a property of the same name is defined in this stimulus.
  • Possible values: The name of another stimulus

"text0":{
  "type": "text",
  "content": "The text in these quotation marks will be displayed.",
  "size": "30px",
  "alignment": "center",
  "color": "blue"
}
"text1": {
  "type": "text",
  "content": "text1 inherits properties from text0.",
  "parent": "text0",
  "color": "red"
}
Here, the text1 stimulus inherits the size and alignment properties of text0. text1 does not inherit the color property of text0 because the stimulus definition of text1 has its own specified color property.

prevent_copy

  • Definition: Whether the participant will be able to copy any part of the text stimulus. If set to true, this disables copying-and-pasting behavior at a system level - not only will right-clicking the text stimulus not bring up a menu, but Ctrl/Command + C keyboard shortcuts will not work either.
  • Possible values: true, false
  • Default: false
{
  "type": "text",
  "content": "The text in these quotation marks will be displayed.",
  "prevent_copy": true
}

size

  • Definition: The font size of the text stimulus
  • Possible values: Either 1) HTML font sizes such as "px", "em", or "rem", or 2) a percentage of the default size
  • The rendered outcome might differ across browsers and devices.
{
  "type": "text",
  "content": "The text in these quotation marks will be displayed.",
  "size": "50%"
}

See Also

Tokenized Text Stimulus