-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Welcome to the cubius wiki!
-
2.1 Modules
2.2 Effects
2.3 Input Options
Experiment scripts need to be valid JSON. You can validate your JSON with any online JSON validator, check out JSONLint
(https://jsonlint.com/).
An experiment has the following keys: structure, entity, and fixationDuration. You can go to example.json in the repository for example scripts.
Structure is an array of JSON objects that contains experiment elements. The index of the element in the array is its default order in the experiment. The element can be trial, block, or run. An element has to have the following keys: id
level
. Blocks and Runs can also have children
.
id
Number. The unique id of an experiment element.
level
String. The type of an experiment element, can be 'trial', 'block', or 'run'.
children
Array. An array of children elements. A block can only have trials as its children. A run can only have blocks as its children.
Entity is an JSON object that contains detail information about each experiment element. A key in an Entity is the unique id of the corresponding element in Structure. The value of a key is in turn a JSON object with the following keys: id
name
type
setting
condition
screenshot
.
id
Number. The unique id of an experiment element. It has to be the same id as in Structure.
name
String. The name of the module used to create the element.
type
String. The type of the module used to create the element.
setting
JSON object. A set of settings for the element. All modules have to have at least one input option specified in their settings. Other than input settings, different modules will have different settings, refer to the modules and input options for settings.
condition
JSON object. A set of conditions for the element. Each condition has a key of a unique id and a value that is in turn a JSON object with the following keys: name
, color
. name
can be any custom-defined condition name. color
has to be a valid hex color code.
screenshot
String. A url or base64 encoding of a screenshot of the element.
FixationDuration can be a string or a number that specifies the blank duration (in milliseconds) between two trials.
name
Run
type
RUN
setting
shuffle
Boolean. Whether shuffle the order of the blocks in run. Default is false.
abtesting
Boolean. Whether randomly present one block in run. Default is false.
shuffle
Boolean. Whether shuffle the order of the trials in block. Default is false.
repeat
String or Number. Number of times to repeat trials in block. Default is 0, no repeat.
lockFirst
Boolean. Whether exclude the first trial in block from shuffling and repeating. Default is false, not excluded.
lockBottom
Boolean. Whether exclude the bottom trial in block from shuffling and repeating. Default is false, not excluded.
name
Text
type
TEXT
setting
content
String. The content of the text trial. Use \n for newline.
font
String. Can be Courier, Arial, Times, sans-serif, serif.
fontSize
Number or String. The font size of the text.
fontColor
String. It has to be a valid hex color code.
fontWeight
String. Can be normal, bold.
name
Image
type
IMAGE
setting
image
String. The url of the image.
alignH
String. The alignment of the image horizontally. Can be left, center, right.
alignV
String. The alignment of the image vertically. Can be top, middle, bottom.
width
String or Number. Set the width of the image. If width is not set, the original width of the image will be used.
height
String or Number. Set the height of the image. If height is not set, the original height of the image will be used.
effect
JSON object. Set the animation effect of the image. Can be 'none', 'flicker', 'flip', 'rotate'. See effects for settings.
name
Mot
type
MOT
setting
image
String. The url of the image.
targetCount
Number or String. The number of targets to track.
nonTargetCount
Number or String. The number of non-targets.
velocity
String or Number. The velocity of the objects moving pixels/second.
interactMode
String. The interact mode when two objects move close. Can be: collide, pass.
duration
String or Number. The duration of the objects moving in milliseconds.
Use the modules in the file directory src/states
as examples. Each module is an extended class of a Phaser state. To learn more about Phaser state, please read the tutorial (http://www.emanueleferonato.com/2014/08/28/phaser-tutorial-understanding-phaser-states/) by Emanuele Feronato, and Phaser's documentation (https://photonstorm.github.io/phaser-ce/). Creating a new module in Cubius is no different than creating a new state in Phaser. But it require a few extra steps (important):
-
At the end of a state, call this.game.waitResponse(). This function will make your module alert to the user input.
-
Add your new state to the index.js file in the directory (
src/states/index.js
), use all capital letter when exporting your state.
duration
String or Number. The duration to flicker once in milliseconds.
repeat
String or Number. The number of times to repeat the flicker animation. Set to -1 to repeat forever.
duration
String or Number. The duration to flip once in milliseconds.
repeat
String or Number. The number of times to repeat the flip animation. Set to -1 to repeat forever.
duration
String or Number. The duration to rotate 360 degree in milliseconds.
repeat
String or Number. The number of times to repeat the rotate animation. Set to -1 to repeat forever.
clockwise
Boolean. Whether rotate clockwise. Default is true.
Use the effects in the file directory src/states/effects
as examples. You can create new effects using Phaser's animation, tween functions, or filters. To learn more, check out Phaser's examples (https://phaser.io/examples). Make sure that you add your new effect to the index.js file in the directory (src/states/effects/index.js
), use all lowercase letter when exporting your effect.
inputAutoTimedAdvance
can co-exist with other input options. The other input options are listed below in their priority order. When two input options are present, the higher order one will over-ride the lower order one.
inputAutoTimedAdvance
String or Number. The time in milliseconds to display the current trial, after which it will proceed to the next trial. reactionTime
will be recorded, it is the same as the time set for this input option.
inputKeyAdvance
Array. An array of valid key code, which listens to keydown event on the keyboard and then proceed to the next trial. Key code from a to z is 65 to 90. keyPress
and reactionTime
will be recorded.
inputErrorFeedbackKeyAdvance
inputErrorFeedbackErrorKey
inputErrorFeedbackMessage
inputErrorFeedbackAllowCorrection
reactionTime
keyPress
wrongKeyPress
will be recorded
inputErrorFeedbackKeyAdvance
Array. An array of valid key code, which listens to keydown event on the keyboard and then proceed to the next trial. Key code from a to z is 65 to 90.
inputErrorFeedbackErrorKey
Array. An array of valid key code, which listens to keydown event on the keyboard and then record the error key pressed. Key code from a to z is 65 to 90.
inputErrorFeedbackMessage
String. A text message to show after an error key is pressed. Default is an empty string, showing nothing.
inputErrorFeedbackAllowCorrection
Boolean. Whether allow correction, default is true. If set to false, the trial will only allow one key press, no matter correct or incorrect, it will proceed to the next trial.
inputNextButton
Boolean. Whether display a next button, which by clicking will proceed to the next trial. reactionTime
will be recorded.
inputTextResponse
Boolean. Whether display a text area for free text response and a next button. reactionTime
and timeResponse
will be recorded.
inputSurveyResponse
String. The url of a survey link to load the survey. reactionTime
and surveyResponse
will be recorded.
The result of an experiment is printed in the console of the browser debug window in two formats, Javascript object and CSV. The minimal structure of a result has the following fields for each trial: id
, order
, module
, screenshot
, note
, condition
. A trial may have additional fields depending on the input option and module type.
id
The unique identifier of the trial.
order
The order that the trial was run in the experiment.
module
The name of the the module used to create the trial.
screenshot
The screenshot of the trial.
note
Any personal note of the trial.
condition
The conditions of the trial.