This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > VRML > December 2003 > Examples - Slider controls - Cylinder sensor node
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Examples - Slider controls - Cylinder sensor node
|
|
| PrisNo6 2003-12-21, 11:49 pm |
| I am looking for some prototypes of controls. In particular, I would
like to create a slider control using a bead on a cylinder. I have
seen these in various online worlds, but have not run across a good
code example. Can someone refer me to a code sample, or post a short
one? Thanks - Kurt
| |
| muaddib 2003-12-21, 11:49 pm |
| Kurt,
You are in luck. There is a subproject at VRSpace to build, as
closely as possible, vrml version of the common Java AWT/Swing
components. I just started working on ScrollBar the other day.
This is just the rudiments of a scroll bar control: a top and bottom
arrow, and a sliding bar. Clicking the arrows triggers the scroll
event, moving the bar triggers scrollFloat which produces a number
between 0 and 1. These events should be routed to the actual node to be
scrolled.
muaddib
Scrollbar.wrl
#VRML V2.0 utf8
PROTO ScrollBar [
eventOut SFInt32 scroll
eventOut SFFloat scrollFloat
] {
Group {
children [
Group {
children [
Inline {
url "ConsoleRes/sliderTopModel.wrl"
}
DEF topScrollBarSensor TouchSensor {}
]
}
Group {
children [
Inline {
url "ConsoleRes/sliderBottomModel.wrl"
}
DEF bottomScrollBarSensor TouchSensor {}
]
}
DEF scrollBar Transform {
children [
Inline {
url "ConsoleRes/sliderBarModel.wrl"
}
DEF scrollBarSensor PlaneSensor {
maxPosition 0 6
minPosition 0 -125
}
]
}
]
}
DEF script Script {
eventIn SFVec3f translation
eventIn SFBool sliderTopIsActive
eventIn SFBool sliderBottomIsActive
eventOut SFInt32 scroll IS scroll
eventOut SFFloat scrollFloat IS scrollFloat
url "java script:
function translation( v, t ) {
scrollFloat = 1 - ( ( v.y + 125 ) / 131);
}
function sliderTopIsActive( v, t ) {
if ( v ) {
scroll = -1;
}
}
function sliderBottomIsActive( v, t ) {
if ( v ) {
scroll = 1;
}
}
"
}
ROUTE scrollBarSensor.translation_changed TO script.translation
ROUTE topScrollBarSensor.isActive TO script.sliderTopIsActive
ROUTE bottomScrollBarSensor.isActive TO script.sliderBottomIsActive
ROUTE scrollBarSensor.translation_changed TO scrollBar.translation
}
--
-------------------------------------------------------
VRSpace - An open source, 3D, modular, cross-platform,
multi-user system with persistent shared objects.
Check out a demo at http://www.vrspace.org/demo.htm
-------------------------------------------------------
| |
| Herbert Stocker 2003-12-21, 11:49 pm |
|
PrisNo6 wrote:quote:
> I am looking for some prototypes of controls. In particular, I would
> like to create a slider control using a bead on a cylinder. I have
> seen these in various online worlds, but have not run across a good
> code example. Can someone refer me to a code sample, or post a short
> one? Thanks - Kurt
Have a look at http://www.hersto.de/VRML/Slider.html
It's my version of a Slider that can be placed in 3D, i.e.
it works from any angle.
It works like the windows sliders: The thumb is proportional
to the page size, and if you click on the part on top/bottom
of the thumb, it moves upwards/downwards by one page.
These Sliders do some smoothing to create more pleasing movements.
Click on the box on the second example to turn this off and verify
the effect.
Herbert
--
Herbert Stocker (aka hersto)
http://www.hersto.de
www.bitmanagement.de
| |
| PrisNo6 2003-12-21, 11:49 pm |
| Herbert Stocker <hst-uzd-nospam@hersto.de> wrote in message news:<3FE55A2B.4030909@hersto.de>...quote:
> PrisNo6 wrote:
> a cylinder.
muaddib and Herbet, thanks as aways for your sharing of these samples. - Kurt
| |
| Robert Lipman 2003-12-22, 12:30 pm |
| PrisNo6 wrote:quote:
>
> I am looking for some prototypes of controls. In particular, I would
> like to create a slider control using a bead on a cylinder. I have
> seen these in various online worlds, but have not run across a good
> code example. Can someone refer me to a code sample, or post a short
> one? Thanks - Kurt
At http://cic.nist.gov/vrml/equip.html near the bottom is a link to my
slider PROTO.
--
Bob Lipman
http://cic.nist.gov/lipman/
|
|
|
| | Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |
|