# JSDoc: Class: VisualStim

# Class: VisualStim

## visual.VisualStim(options)

#### new VisualStim(options)

Base class for all visual stimuli.

##### 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
`units` | string | <optional> | "height" | the units of the stimulus (e.g. for size, position, vertices)
`ori` | number | <optional> | 0.0 | the orientation (in degrees)
`opacity` | number | <optional> | 1.0 | the opacity
`depth` | number | <optional> | 0 | the depth (i.e. the z order)
`pos` | Array.<number> | <optional> | [0, 0] | the position of the center of the stimulus
`size` | number | <optional> | 1.0 | the size
`clipMask` | PIXI.Graphics | <optional> | null | 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:
  - WindowMixin
Source:
  - visual/VisualStim.js, line 15

### Extends

- MinimalStim

### Members

#### contains

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

Source:
  - visual/VisualStim.js, line 184

#### refresh

Force a refresh of the stimulus. refresh() is called, in particular, when the Window is resized.

Source:
  - visual/VisualStim.js, line 92

#### setOri

Setter for the orientation attribute.

Source:
  - visual/VisualStim.js, line 133

#### setPos

Setter for the position attribute.

Source:
  - visual/VisualStim.js, line 161

#### setSize

Setter for the size attribute.

Source:
  - visual/VisualStim.js, line 105

### Methods

#### (protected) _estimateBoundingBox()

Estimate the bounding box.

Source:
  - visual/VisualStim.js, line 211

#### (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

Source:
  - visual/VisualStim.js, line 266

##### Returns:

Type
  function

#### (protected) contains() → {PIXI.Rectangle}

Get the bounding box in pixel coordinates

Source:
  - visual/VisualStim.js, line 227

##### Returns:

the bounding box, in pixel coordinates

Type
  PIXI.Rectangle