Spiritdude/OpenJSCAD.org — pull request #44 by derrickoswald (2014-07-11 19:58:13+00:00)
Title: Add support for HTML5 number spinner as parameter input.

Small request from Kurt Meister. He actually wanted a slider, but a slider with a rebuildSolid() call would suck.

I'm not sure where the documentation lives, but here's some text and an example usage:

A float, int, number or text parameter is created by including the following object in the array returned by getParameterDefinitions():
```javascript
{
name: 'width',
type: 'float', // or 'text' or 'int'
initial: 1.23, // optional, sets the initial value
// NOTE: parameter "default" is deprecated
caption: 'Width of the thingy:', // optional, displayed left of the input field
// if omitted, the 'name' is displayed (i.e. 'width')

}
```
The number parameter type will only work in HTML5 browsers and you should probably also include the standard attributes min, max and step, as in this example:

```javascript
// -- OpenJSCAD.org logo
function getParameterDefinitions() {
return [
{ name: 'size', type: 'number', initial: 3, caption: "Size of the cube:", min: 2.0, max: 3.5, step: 0.1 }
];
}

function main(params) {
return union(
difference(
cube({size: params.size, center: true}),
sphere({r:2, center: true})
),
intersection(
sphere({r: 1.3, center: true}),
cube({size: 2.1, center: true})
)
).translate([0,0,1.5]).scale(10);
}
```