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 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>
'norm' the units of the text size and position
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
fontFamily string <optional>
'Helvetica' 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>
14 the font size of the labels (in pixels)
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
  • style "slider"
  • complete setters, for instance setTicks should change this._isCategorical

Extends

Members

(private) _applyStyle

Apply a particular style to the slider.
Source:

(private) _buildSlider

Setup the PIXI components of the slider (bar, ticks, labels, marker, etc.).
Source:

(private) _granularise

Calculate the rating once granularity has been taken into account.
Source:

(private) _isHorizontal

Determine whether the slider is horizontal.

The slider is horizontal is its x-axis size is larger than its y-axis size.

Source:

(private) _posToRating

Convert a [x,y] position, in pixel units, relative to the slider, into a rating.
Source:

(private) _ratingToPos

Convert an array of ratings into an array of [x,y] positions (in Slider units, with 0 at the center of the Slider)
Source:

(private) _updateIfNeeded

Update the stimulus, if necessary.
Source:

(private) _updateMarker

Update the position of the marker if necessary.
Source:

contains

Determine whether an object is inside the bounding box of the slider.
Source:
To Do:
  • this is currently not implemented and always returns false

getRating

Get the current value of the rating.
Source:

getRT

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

recordRating

Set the current rating.

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

Source:

reset

Reset the slider.
Source:

setBold

Setter for the bold attribute.
Source:

setItalic

Setter for the italic attribute.
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:

setOpacity

Setter for the opacity attribute.
Inherited From:
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) Style :Symbol

Styles.
Type:
  • Symbol
Source: