|
The Slider node is the the VRML version of a slider control
known from 2D graphical user interfaces.
EXTERNPROTO Slider
[
exposedField SFFloat min # 0
exposedField SFFloat max # 1
exposedField SFFloat pageSize # .2
eventOut SFFloat position_changed
eventIn SFFloat set_position
field SFFloat initial_position # .5
exposedField SFFloat height # 2
exposedField SFFloat radiusStick # .2
exposedField SFFloat radiusKnob # .3
exposedField SFBool smoothMovements # TRUE
exposedField SFNode appearance # NULL
]
"Slider.wrl#Slider"
|
|
|
Explanation of the fields:
The Slider consists of a thin, long
Cylinder – the
stick – and a thicker, shorter
Cylinder – the
Knob – that
you can move over the stick. While you move the knob, a
position_changed eventOut
emits SFFloat values
indicating the position. You can also click on the stick to move
the knob up and down by a specifyable page size.
In contrast to the sliders known from 2D GUIs, all movements are
smoothed a bit to create more pleasuring animations.
min and max
allow you to specify the range of values that can be emitted by this
slider.
pageSize defines the increment
or decrement that is added to the current value when you click on the stick.
It also defines the size (length) of the knob relative to the stick.
These indicate or control the positon of the knob.
position_changed emits the
current value of the slider whenever the knob moves,
set_position lets you move
the knob programmatically and
initial_position lets you
specify where the knob should be placed on initialization.
These define the geometric appearance of the slider.
height is the length
of the stick.
radiusStick and
radiusKnob specify
the radius of the inner and outer cylinder.
The length of the knob cylinder is implicitely specified by the
pageSize field.
When smoothMovements is set to TRUE
the effect of a weightfull knob is created by a smoothing operation as explained
in The Dampers. The Slider
creates softer movements even if it is moved page by page.
This allows you to specify the
Appearance
that should be used for both cylinders.
The Demos:
Demo 1:
On the top of the screen there are three Sliders with
different parameters for the min,
max and
pageSize fields.
A Script combines
their position_changed
outputs to one SFVec3f
that is routed to the scale
field of a Transform
that contains a Box.
Demo 2:
This contains three Sliders that
are routed to a little Script node
that combines the three SFFloat values
to one SFVec3f and routes it to
the scale field of a Box
object.
Rotatate the scene to see that these sliders can intuitively be used in any orientation.
Other uses:
The following pages on this web site contain demo files that
use the slider control:
__.-.__ end of document
|