Class: Slider

visual.Slider(options)

new Slider(options)

Slider stimulus.
Parameters:
Name Type Description
options Object
Properties
Name Type Attributes Default Description
name String the name used when logging messages from this stimulus
win module:core.Window the associated Window
pos Array.<number> <optional>
[0, 0] the position of the center of the slider
size Array.<number> the size of the slider, e.g. [1, 0.1] for an horizontal slider
ori number <optional>
0.0 the orientation (in degrees)
units string <optional>
'height' the units of the Slider position, and font size
color Color <optional>
Color('LightGray') the color of the slider
contrast number <optional>
1.0 the contrast of the slider
opacity number <optional>
1.0 the opacity of the slider
style string <optional>
[Slider.Style.RATING] the slider style
ticks Array.<number> <optional>
[1,2,3,4,5] the array of ticks
labels Array.<number> <optional>
[] the array of labels
granularity number <optional>
0 the granularity
flip boolean <optional>
false whether or not to flip the position of the marker, ticks, and labels with respect to the central bar
readOnly boolean <optional>
false whether or not the slider is read only
font string <optional>
'Arial' the text font
bold boolean <optional>
true whether or not the font of the labels is bold
italic boolean <optional>
false whether or not the font of the labels is italic
fontSize number <optional>
the font size of the labels (in pixels), the default fontSize depends on the Slider's units: 14 for 'pix', 0.03 otherwise
compact boolean <optional>
false whether or not the slider is compact, i.e. whether all graphical elements (e.g. labels) fit within its size
clipMask PIXI.Graphics the clip mask
autoDraw boolean <optional>
false whether or not the stimulus should be automatically drawn on every frame flip
autoLog boolean <optional>
false whether or not to log
Mixes In:
Source:
To Do:
  • check that parameters are valid, e.g. ticks are an array of numbers, etc.
  • readOnly
  • complete setters, for instance setTicks should change this._isCategorical
  • flesh out the skin approach

Extends

Members

contains

Determine whether an object is inside the bounding box of the stimulus.
Overrides:
Source:

getRating

Get the current value of the rating.
Source:

getRT

Get the response time of the most recent change to the rating.
Source:

refresh

Force a refresh of the stimulus.
Overrides:
Source:

reset

Reset the slider.
Source:

setMarkerPos

Setter for the markerPos attribute.

Setting markerPos changes the visible position of the marker to the specified rating but does not change the actual rating returned by the slider.

Source:

setOri

Setter for the orientation attribute.
Inherited From:
Source:

setPos

Setter for the position attribute.
Inherited From:
Source:

setRating

Setter for the rating attribute.

Setting the rating does not change the visible position of the marker.

Source:

setReadOnly

Setter for the readOnly attribute.

Read-only sliders are half-opaque and do not provide responses.

Source:

setSize

Setter for the size attribute.
Inherited From:
Source:

(readonly) Shape :Symbol

Shape of the marker and of the ticks.
Type:
  • Symbol
Source:

(readonly) Skin :any

Skin.
Type:
  • any
Source:

(readonly) Style :Symbol

Styles.
Type:
  • Symbol
Source:

Methods

(protected) _estimateBoundingBox()

Estimate the bounding box.
Overrides:
Source:

(protected) _onChange(withPixiopt, withBoundingBoxopt) → {function}

Generate a callback that prepares updates to the stimulus. This is typically called in the constructor of a stimulus, when attributes are added with _addAttribute.
Parameters:
Name Type Attributes Default Description
withPixi boolean <optional>
false whether or not the PIXI representation must also be updated
withBoundingBox boolean <optional>
false whether or not to immediately estimate the bounding box
Inherited From:
Source:
Returns:
Type
function

(protected) _sanitizeAttributes()

Sanitize the slider attributes: check for attribute conflicts, missing values, etc.
Source:

recordRating(rating, responseTimeopt, logopt)

Set the current rating.

Setting the rating does also change the visible position of the marker.

Parameters:
Name Type Attributes Default Description
rating number the rating
responseTime number <optional>
the reaction time
log boolean <optional>
false whether of not to log
Source: