create a spotlight div
Name | Type | Description | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
optional
|
Members
-
the list of spotlights. if manually changed then call redraw() to update the canvas
Methods
-
circle (x, y, radius, noRedraw)Spotlight
-
adds a circle spotlight
Name Type Description x
number y
number radius
number noRedraw
boolean optional don't force a canvas redraw
Returns:
Type Description Spotlight -
clear (noRedraw)Spotlight
-
clears any cutouts
Name Type Description noRedraw
boolean optional don't force a canvas redraw
Returns:
Type Description Spotlight -
removes spotlight
-
fadeIn (options)Spotlight
-
fade in the under layer
Name Type Description options
* optional Name Type Default Description start
number 0 optional starting opacity
end
number 1 optional ending opacity
duration
number 1000 optional duration of fade in milliseconds
ease
string | function 'easeInOutSine' optional easing function (@see https://www.npmjs.com/package/penner)
onEnd
function optional callback after fading
Returns:
Type Description Spotlight -
fadeOut (options)Spotlight
-
fade out the under layer
Name Type Description options
* optional Name Type Default Description start
number 1 optional starting opacity
end
number 0 optional ending opacity
duration
number 1000 optional duration of fade in milliseconds
ease
string | function 'easeInOutSine' optional easing function (@see https://www.npmjs.com/package/penner)
onEnd
function optional callback after fading
Returns:
Type Description Spotlight -
hide ()Spotlight
-
hide spotlight
Returns:
Type Description Spotlight -
checks whether spotlight is visible
Returns:
Type Description boolean -
polygon (points, noRedraw)Spotlight
-
adds a polygon spotlight
Name Type Description points
Array.<number> [x1, y1, x2, y2, ... xn, yn]
noRedraw
boolean optional don't force a canvas redraw
Returns:
Type Description Spotlight -
rectangle (x, y, width, height, noRedraw)Spotlight
-
adds a rectangle spotlight
Name Type Description x
number y
number width
number height
number noRedraw
boolean don't force a canvas redraw
Returns:
Type Description Spotlight -
redraw ()Spotlight
-
force a redraw of the spotlight (usually called internally)
Returns:
Type Description Spotlight -
resize ()Spotlight
-
resize the layer to ensure entire screen is covered; also calls redraw()
Returns:
Type Description Spotlight -
show ()Spotlight
-
show spotlight
Returns:
Type Description Spotlight