Class: Spring

Spring

represents elastic spring

new Spring(params)

Spring [GeomObj]
This:
Parameters:
Name Type Description
params Object parameters, see below
Properties
Name Type Argument Description
x number <optional>
=0.] x coordinate of spring start [pixel]
y number <optional>
=0.] y coordinate of spring start [pixel]
size number <optional>
=200.] length of the spring [pixel]
width number <optional>
=40.] width of the spring [pixel]
angle number <optional>
=0.] the spring will be rotated by angle [deg]
offset number <optional>
=20.] gap between spring start and actual spring [pixel]
num number <optional>
=14] number of peaks
Properties:
Name Type Description
width number width of the spring [pixel]
offset number gap between spring start and actual spring [pixel]
num number number of peaks
Source:
  • /var/www/html/software/raphaelsm/raphaelsm.src.js, line 1461

Extends

Methods

copy(shifts)

Copy receiver
Parameters:
Name Type Description
shifts Array.<Array.<number>> array of [x,y] couple of copies shifts
Inherited From:
Source:
  • /var/www/html/software/raphaelsm/raphaelsm.src.js, line 160

cos()

Compute cos from stored angle
Inherited From:
Source:
  • /var/www/html/software/raphaelsm/raphaelsm.src.js, line 83

makeCopy() → {Raphael.fn.Spring}

Returns copy of receiver
Source:
  • /var/www/html/software/raphaelsm/raphaelsm.src.js, line 1494
Returns:
copy of receiver
Type
Raphael.fn.Spring

rotate(phi)

Rotate receiver by given angle (this.angle += phi)
Parameters:
Name Type Description
phi number angle of rotation
Inherited From:
Source:
  • /var/www/html/software/raphaelsm/raphaelsm.src.js, line 144

setAngle(phi)

Set angle of receiver (this.angle = phi)
Parameters:
Name Type Description
phi number angle of rotation
Inherited From:
Source:
  • /var/www/html/software/raphaelsm/raphaelsm.src.js, line 152

setPathList()

Sets svg path of receiver
Source:
  • /var/www/html/software/raphaelsm/raphaelsm.src.js, line 1474

setX(x)

Sets new x position of receiver (this.x = x)
Parameters:
Name Type Description
x number new x coordinate [pixel]
Inherited From:
Source:
  • /var/www/html/software/raphaelsm/raphaelsm.src.js, line 104

setXY(x, y)

Sets new x and y position of receiver (this.x = x; this.y = y)
Parameters:
Name Type Description
x number new x coordinate [pixel]
y number new y coordinate [pixel]
Inherited From:
Source:
  • /var/www/html/software/raphaelsm/raphaelsm.src.js, line 95

setY(y)

Sets new y position of receiver (this.y = y)
Parameters:
Name Type Description
y number new y coordinate [pixel]
Inherited From:
Source:
  • /var/www/html/software/raphaelsm/raphaelsm.src.js, line 112

sin()

Compute sin from stored (anti-clockwise) angle
Inherited From:
Source:
  • /var/www/html/software/raphaelsm/raphaelsm.src.js, line 77

translateX(dx)

Translate receiver in x direction (this.x += x)
Parameters:
Name Type Description
dx number distance to be translated [pixel]
Inherited From:
Source:
  • /var/www/html/software/raphaelsm/raphaelsm.src.js, line 130

translateXY(dx, dy)

Translate receiver in x and y direction (this.x += dx; this.y += dy)
Parameters:
Name Type Description
dx number distance to be translated in x direction [pixel]
dy number distance to be translated in y direction [pixel]
Inherited From:
Source:
  • /var/www/html/software/raphaelsm/raphaelsm.src.js, line 121

translateY(dy)

Translate receiver in x direction (this.y += dy)
Parameters:
Name Type Description
dy number distance to be translated [pixel]
Inherited From:
Source:
  • /var/www/html/software/raphaelsm/raphaelsm.src.js, line 137

update()

Update receiver (set this.pathList for given internal variables - x,y,angle... - as well as its copies)
Inherited From:
Source:
  • /var/www/html/software/raphaelsm/raphaelsm.src.js, line 174