Special commands
Used within a trial, but not called on an element.
table of contents
clear
syntax
clear()
description
Removes from the screen any element that was previously added during the trial.
example
click to expand
newText("helloworld", "Hello world!")
.print()
,
newImage("smiley", "ya.png")
.print()
,
newButton("erase", "Erase")
.print()
.wait()
,
clear()
,
newButton("void", "Enough with the emptiness")
.print()
.wait()
- Prints a line of
Text
, anImage
and aButton
with the text"erase"
to the screen. - Remove the three elements from the screen when the
"erase"
Button
is clicked. - Print a new
Button
that is waiting to be clicked to the screen.
end
syntax
end()
description
Ends a trial immediately.
example
click to expand
PennController.ResetPrefix(null);
newTrial(
newText("instructions", "Press F to end the trial immediately, or press J to continue.")
.print()
,
newKey("fj", "FJ")
.wait()
,
getKey("fj")
.test.pressed("F")
.success(end())
.failure(
newText("continue", "The trial has continued! Press the spacebar to finish.")
.print()
,
newKey(" ")
.wait()
)
)
- Prints the
"instructions"
Text
element to the screen. - Creates the
"fj"
Key
element and waits for theF
orJ
key to be pressed.- If
F
was pressed, end the trial immediately. - Otherwise, print the
"continue"
Text
element and wait for theSpacebar
key to be pressed.
- If
exitFullscreen
fullscreen
syntax
fullscreen()
description
Sends a fullscreen request to the participant’s browser.
example
click to expand
newTrial(
newButton("Start the experiment and go fullscreen!")
.print()
.wait()
,
fullscreen()
)
newTrial(
newScale(100)
.before( newText("It is cold here") )
.after( newText("It is warm here") )
.slider()
.print()
.wait()
)
SendResults()
newTrial(
exitFullscreen()
,
newText("Thank you for your participation!")
.print()
,
newTimer().wait()
)