Hypotrochoid Class
Hypotrochoid. http://en.wikipedia.org/wiki/Hypotrochoid
Constructor
Hypotrochoid
-
[options]
Parameters:
-
[options]
Object optional- The settings.
-
[R]
Number optional- Radius of the outer circle.
-
[r]
Number optional- Radius of the inner circle.
-
[d=0.0]
Number optional- Distance from the center to the inner circle.
-
[origin={x: 0.0, y: 0.0}]
Object optional- Object with x and y components, representing the origin coordinates.
-
[rotation=0.0]
Number optional- Sets the rotational direction and speed. (Negative for left rotation, 0.0 for no rotation.)
-
[iterations=64]
Number optional- Limits the processing of very detailed hypotrochoids.
-
[opacity=0.75]
Number optional- The opacity.
-
[lineWidth=0.5]
Number optional- The line width.
-
[colourRoll=true]
Boolean optional- Whether the colour should change continuously.
-
[hue=0.0]
Number optional- The hue in degree.
-
[saturation=100.0]
Number optional- The saturation in percent.
-
[luminance=50.0]
Number optional- The luminance in percent.
Item Index
Properties
Methods
draw
-
ctx
Draws the hypotrochoid onto the given 2D-context. This function does not clear the canvas.
Parameters:
-
ctx
CanvasRenderingContext2D- The surface to draw on.
equal
-
a
-
b
Checks if two float values are (almost) equal.
Parameters:
-
a
Number- Value a.
-
b
Number- Value b.
Returns:
Whether the values are equal or not.
update
()
Updates hue and rotation.
Properties
colourRoll
Boolean
Colour roll flag.
d
Number
d.
EPSILON
Number
private
final
static
A float threshold.
firstCoord
Object
private
The first 2D-point in the draw process.
firstCoord
Object
private
The previous 2D-point in the draw process.
hue
Number
The current hue.
iterations
Number
Maximum iteration count.
lineWidth
Number
The line width.
luminance
Number
The current limunance.
opacity
Object
the current opacity.
origin
Object
The origin of the hypotrochoid.
r
Number
r.
R
Number
R.
rInv
Number
private
The inverted r value.
rotation
Number
private
Current rotation.
rotationSpeed
Number
Rotation speed and direction.
saturation
Number
The current saturation.
settings
Object
The hypotrochoid's settings: { r, R, d, iterations, rotation, origin, opacity, lineWidth, colourRoll, saturation, luminance, hue }
step
Number
private
Theta is incremented by step.
theta
Number
private
Incremented by step, used to draw the hypotrochoid.
TWO_PI
Number
private
final
Pi * 2.