PipeWalls

Draw the pipe walls

  • Makes a copy of a slice of the canvas
  • Scales the copy and draws it on top of the original slice
  • Repeats the process to make wall edges
Author
  • Mark Mayes / mm-dev
License
  • GPL-3.0-only

Methods

(static) addGradientColorStops()

Source
Add the colour stops to the gradient

The gradient gets recreated on every call to draw(), so the stops must be re-applied.

(static) draw()

Source
Calculate the latest positions of and draw the walls

(static) drawSingleWall(_x, _y)

Source
Draw a single wall

Called twice by the main drawing function.

Parameters
Name Type Description
_x number

Positioning coordinate

_y number

Positioning coordinate

(static) init()

Source
Creates a canvas on which the pipe walls are drawn before copying into the main canvas

Uses an offscreen canvas if the browser supports it, to improve performance.

(static) updateSizes()

Source
Calculate wall sizes based on the current viewport/layout