|
MathWorx | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object | +--SceneButton
This class defines various buttons (images with javascript actions) to change/rotate the Scene3D and re-draw it.
The icons used are Sanscons from Some Random Dude. See: http://somerandomdude.net/srd-projects/sanscons
You must have a CSS file (our default is SceneButton.css) and include it in your HTML document with a tag.
The default class used for buttons is "button", but you may define your own as you see fit and specify them as a parameter in your function calls.
Because this class is interested in re-drawing the SVG canvas, it requires jQuery SVG and so the necessary files must be included on the top of the page.
For more info, see the static method documentation below. An example call of a specific button:
SceneButton.rotateZp(document.getElementById("button"), 'svg', 'scene', Math.PI/8, "[{stroke: 'black', 'stroke-width': .25}, {stroke: 'red', 'stroke-width': .125}, {stroke: 'green', 'stroke-width': .125}, {stroke: 'blue', 'stroke-width': .125}]", true);
To change the images displayed for each button, edit SceneButton.js with the according images (pathToButtons variable is set in easyload.js). The "button" class is defined in SceneButton.css, bt you can define your own classes however you desire; for usage of the default button set here, see Sancsons
For a working demo (with jQuery and jQuery SVG), see: http://cis.jhu.edu/~shanest/js/mathworx/3D/testbutton.html
Constructor Summary | |
SceneButton(parent, scene, continuous, img, func, class)
The constructor function for a new SceneButton. |
Method Summary | |
<static> void
|
makeAll(parent, svg, scene, <Number> zStep, <Number> rStep, settings, continuous, class)
Makes all the buttons and appends them to the parent DOM node. |
<static> SceneButton
|
rotate(parent, svg, scene, step, <String> xySign, <String> zSign, settings, continuous, class)
For specification of most parameters, see rotateNW(), rotateNE(), rotateSW() or rotateSE(). |
<static> SceneButton
|
rotateNE(<Object> parent, <String> svg, <String> scene, <Number> step, <String> settings, <Boolean> continuous, <String> class)
Creates a button responsible for "North-east" (positive around Z and XY) rotation. |
<static> SceneButton
|
rotateNW(<Object> parent, <String> svg, <String> scene, <Number> step, <String> settings, <Boolean> continuous, <String> class)
Creates a button responsible for "North-west" (positive around Z, negative around XY) rotation. |
<static> SceneButton
|
rotateSE(<Object> parent, <String> svg, <String> scene, <Number> step, <String> settings, <Boolean> continuous, <String> class)
Creates a button responsible for "South-east" (negative around Z, positive around XY) rotation. |
<static> SceneButton
|
rotateSW(<Object> parent, <String> svg, <String> scene, <Number> step, <String> settings, <Boolean> continuous, <String> class)
Creates a button responsible for "South-west" (negative around Z and XY) rotation. |
<static> SceneButton
|
rotateXY(parent, svg, scene, step, <String> sign, settings, continuous, class)
For specification of most parameters, see rotateXYp() or rotateXYn(). |
<static> SceneButton
|
rotateXYn(<Object> parent, <String> svg, <String> scene, <Number> step, <String> settings, <Boolean> continuous, <String> class)
Creates a button responsible for negative rotation about the XY-plane. |
<static> SceneButton
|
rotateXYp(<Object> parent, <String> svg, <String> scene, <Number> step, <String> settings, <Boolean> continuous, <String> class)
Creates a button responsible for positive rotation about the XY-plane. |
<static> SceneButton
|
rotateZ(parent, svg, scene, step, <String> sign, settings, continuous, class)
For specification of most parameters, see rotateZp() or rotateZn(). |
<static> SceneButton
|
rotateZn(<Object> parent, <String> svg, <String> scene, <Number> step, <String> settings, <Boolean> continuous, <String> class)
Creates a button responsible for negative rotation about the Z-axis. |
<static> SceneButton
|
rotateZp(<Object> parent, <String> svg, <String> scene, <Number> step, <String> settings, <Boolean> continuous, <String> class)
Creates a button responsible for positive rotation about the Z-axis. |
<static> void
|
toggle(<String> func)
Toggles animation of the scene. |
<static> SceneButton
|
zoom(parent, svg, scene, step, <String> sign, settings, continuous, class)
For specification of most parameters, see zoomIn() or zoomOut(). |
<static> SceneButton
|
zoomIn(<Object> parent, <String> svg, <String> scene, <Number> step, <String> settings, <Boolean> continuous, <String> class)
Zooms in on the objects in the Scene3D. |
<static> SceneButton
|
zoomOut(<Object> parent, <String> svg, <String> scene, <Number> step, <String> settings, <Boolean> continuous, <String> class)
Zooms out on the objects in the Scene3D. |
Constructor Detail |
SceneButton(parent, scene, continuous, img, func, class)
Method Detail |
<static> void makeAll(parent, svg, scene, <Number> zStep, <Number> rStep, settings, continuous, class)
zStep
- the increment to zoom by for the zoomIn/zoomOut buttons
rStep
- the increment (radians) to use for the rotation methods
<static> SceneButton rotate(parent, svg, scene, step, <String> xySign, <String> zSign, settings, continuous, class)
xySign
- '+' or '-' for the direction of the rotation about XY plane (rotateXY())
zSign
- '+' or '-' for the direction of the rotation about Z axis (rotateZ())
<static> SceneButton rotateNE(<Object> parent, <String> svg, <String> scene, <Number> step, <String> settings, <Boolean> continuous, <String> class)
parent
- the DOM node that will be the parent of the button image
svg
- the name of your jQuery SVG root variable
scene
- the name of your Scene3D object variable
step
- the increment to rotate each time
settings
- the string version of a settings object; same as draw method settings, but surround with quotation marks
continuous
- (optional) true if want animation; false by default
class
- (optional) the class name to give your image tags; defaults to "button" as defined in SceneButton.css. Must specify a boolean for continuous if want to use this parameter
<static> SceneButton rotateNW(<Object> parent, <String> svg, <String> scene, <Number> step, <String> settings, <Boolean> continuous, <String> class)
parent
- the DOM node that will be the parent of the button image
svg
- the name of your jQuery SVG root variable
scene
- the name of your Scene3D object variable
step
- the increment to rotate each time
settings
- the string version of a settings object; same as draw method settings, but surround with quotation marks
continuous
- (optional) true if want animation; false by default
class
- (optional) the class name to give your image tags; defaults to "button" as defined in SceneButton.css. Must specify a boolean for continuous if want to use this parameter
<static> SceneButton rotateSE(<Object> parent, <String> svg, <String> scene, <Number> step, <String> settings, <Boolean> continuous, <String> class)
parent
- the DOM node that will be the parent of the button image
svg
- the name of your jQuery SVG root variable
scene
- the name of your Scene3D object variable
step
- the increment to rotate each time
settings
- the string version of a settings object; same as draw method settings, but surround with quotation marks
continuous
- (optional) true if want animation; false by default
class
- (optional) the class name to give your image tags; defaults to "button" as defined in SceneButton.css. Must specify a boolean for continuous if want to use this parameter
<static> SceneButton rotateSW(<Object> parent, <String> svg, <String> scene, <Number> step, <String> settings, <Boolean> continuous, <String> class)
parent
- the DOM node that will be the parent of the button image
svg
- the name of your jQuery SVG root variable
scene
- the name of your Scene3D object variable
step
- the increment to rotate each time
settings
- the string version of a settings object; same as draw method settings, but surround with quotation marks
continuous
- (optional) true if want animation; false by default
class
- (optional) the class name to give your image tags; defaults to "button" as defined in SceneButton.css. Must specify a boolean for continuous if want to use this parameter
<static> SceneButton rotateXY(parent, svg, scene, step, <String> sign, settings, continuous, class)
sign
- '-' for negative rotation, '+' for positive rotation
<static> SceneButton rotateXYn(<Object> parent, <String> svg, <String> scene, <Number> step, <String> settings, <Boolean> continuous, <String> class)
parent
- the DOM node that will be the parent of the button image
svg
- the name of your jQuery SVG root variable
scene
- the name of your Scene3D object variable
step
- the increment to rotate each time
settings
- the string version of a settings object; same as draw method settings, but surround with quotation marks
continuous
- (optional) true if want animation; false by default
class
- (optional) the class name to give your image tags; defaults to "button" as defined in SceneButton.css. Must specify a boolean for continuous if want to use this parameter
<static> SceneButton rotateXYp(<Object> parent, <String> svg, <String> scene, <Number> step, <String> settings, <Boolean> continuous, <String> class)
parent
- the DOM node that will be the parent of the button image
svg
- the name of your jQuery SVG root variable
scene
- the name of your Scene3D object variable
step
- the increment to rotate each time
settings
- the string version of a settings object; same as draw method settings, but surround with quotation marks
continuous
- (optional) true if want animation; false by default
class
- (optional) the class name to give your image tags; defaults to "button" as defined in SceneButton.css. Must specify a boolean for continuous if want to use this parameter
<static> SceneButton rotateZ(parent, svg, scene, step, <String> sign, settings, continuous, class)
sign
- '+' for negative rotation, '-' for positive rotation
<static> SceneButton rotateZn(<Object> parent, <String> svg, <String> scene, <Number> step, <String> settings, <Boolean> continuous, <String> class)
parent
- the DOM node that will be the parent of the button image
svg
- the name of your jQuery SVG root variable
scene
- the name of your Scene3D object variable
step
- the increment to rotate each time
settings
- the string version of a settings object; same as draw method settings, but surround with quotation marks
continuous
- (optional) true if want animation; false by default
class
- (optional) the class name to give your image tags; defaults to "button" as defined in SceneButton.css. Must specify a boolean for continuous if want to use this parameter
<static> SceneButton rotateZp(<Object> parent, <String> svg, <String> scene, <Number> step, <String> settings, <Boolean> continuous, <String> class)
parent
- the DOM node that will be the parent of the button image
svg
- the name of your jQuery SVG root variable
scene
- the name of your Scene3D object variable
step
- the increment to rotate each time
settings
- the string version of a settings object; same as draw method settings, but surround with quotation marks
continuous
- (optional) true if want animation; false by default
class
- (optional) the class name to give your image tags; defaults to "button" as defined in SceneButton.css. Must specify a boolean for continuous if want to use this parameter
<static> void toggle(<String> func)
func
- the string representation of the function to be executed when animated.
<static> SceneButton zoom(parent, svg, scene, step, <String> sign, settings, continuous, class)
sign
- '+' for zooming out, '-' for zooming in
<static> SceneButton zoomIn(<Object> parent, <String> svg, <String> scene, <Number> step, <String> settings, <Boolean> continuous, <String> class)
parent
- the DOM node that will be the parent of the button image
svg
- the name of your jQuery SVG root variable
scene
- the name of your Scene3D object variable
step
- the increment to zoom in by each time
settings
- the string version of a settings object; same as draw method settings, but surround with quotation marks
continuous
- (optional) true if want animation; false by default
class
- (optional) the class name to give your image tags; defaults to "button" as defined in SceneButton.css. Must specify a boolean for continuous if want to use this parameter
<static> SceneButton zoomOut(<Object> parent, <String> svg, <String> scene, <Number> step, <String> settings, <Boolean> continuous, <String> class)
parent
- the DOM node that will be the parent of the button image
svg
- the name of your jQuery SVG root variable
scene
- the name of your Scene3D object variable
step
- the increment to zoom out by each time
settings
- the string version of a settings object; same as draw method settings, but surround with quotation marks
continuous
- (optional) true if want animation; false by default
class
- (optional) the class name to give your image tags; defaults to "button" as defined in SceneButton.css. Must specify a boolean for continuous if want to use this parameter
|
MathWorx | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |