[x3d-public] HTML slider and TimeSensor scrubbing behavior
Andreas Plesch
andreasplesch at gmail.com
Tue Dec 17 05:06:41 PST 2019
Hi Mike,
let me try. Since there is no way to directly set the fraction of the
timesensor, I think you can only use it indirectly if you want to use it in
combination with another control on the progress of an animation.
Let's call the position on the slider progress. The idea would be to add
the timesensor's fraction_changed to current progress when play is
requested. To keep things simple it might be best set start time to now
when play is pressed to start with a fraction of 0 to add.
Then when the slider is dragged stop the time sensor and update progress by
the sliders value.
Then when dragging stops it would be probably easiest and least surprising
if playing would pause until the play button is pressed again.
The main point is that the timesensors time should not directly represent
playing time or progress.
I think that approach could work,
Andreas
---on the phone---
On Mon, Dec 16, 2019 at 11:36 AM Mike McCann <mccann at mbari.org> wrote:
>
> I Andreas,
>
> I did get Vince’s suggestion of
"InterpolatorNode.setFieldValue('set_fraction', ts_fraction)” to work. I
will try your suggestion as well.
>
> Regarding your suggestion of resetting startTime after scrubbing, I
assume that this might be meant to set the new fraction of the TimeSensor
to the scrubbed value.
>
> However, this does not work for me. In fact, I can see no way to set a
new fraction value for the TimeSensor when playing begins after scrubbing,
given it’s specification:
>
> TimeSensor : X3DTimeDependentNode, X3DSensorNode {
> SFTime [in,out] cycleInterval 1 (0,∞)
> SFBool [in,out] enabled TRUE
> SFBool [in,out] loop FALSE
> SFNode [in,out] metadata NULL [X3DMetadataObject]
> SFTime [in,out] pauseTime 0 (-∞,∞)
> SFTime [in,out] resumeTime 0
> SFTime [in,out] startTime 0 (-∞,∞)
> SFTime [in,out] stopTime 0 (-∞,∞)
> SFTime [out] cycleTime
> SFTime [out] elapsedTime
> SFFloat [out] fraction_changed
> SFBool [out] isActive
> SFBool [out] isPaused
> SFTime [out] time
> }
>
> Am I missing something?
>
> -Mike
>
> On Dec 15, 2019, at 5:07 AM, Andreas Plesch <andreasplesch at gmail.com>
wrote:
>
> Hi Joe,
>
> Thanks for the memory jog. I recall doing it this way in pure VRML.
>
> What I can?t figure out is how to ?route? the output of the HTML slider
into X3DOM's Interpolators. Is there an attribute in the x3dom runtime that
I can set?
>
> -Mike
>
>
> Hi Mike,
>
> as in Vince's example, you should be able use the set_fraction field
> of the interpolator as attribute.
> InterpolatorNode.setAttribute('set_field', newValuefromSlider) should
> work.
>
> It might work to use a timesensor's fraction_changed as an _offset_ to
> the last position of the slider when the play button was pressed.
>
> This probably means that the startTime of the timesensor needs to be
> reset to now each time playing begins after scrubbing.
>
> -Andreas
>
> On Dec 13, 2019, at 1:44 PM, Joseph D Williams <joedwil at earthlink.net>
wrote:
>
> Hi Mike,
> Same as to do a slider control in x3d?
> You disconnect the TimeSensor and drive the Position and Orientation
Interpolators with a number you derive from the slider, I think.
> Joe
>
> From: Mike McCann <mailto:mccann at mbari.org>
> Sent: Friday, December 13, 2019 10:25 AM
> To: x3dom mlist <mailto:x3dom-users at lists.sourceforge.net>; X3D Graphics
public mailing list <mailto:x3d-public at web3d.org>
> Subject: [x3d-public] HTML slider and TimeSensor scrubbing behavior
>
> Hello,
>
> I have a TimeSensor that drives Position and Orientation Interpolators
via ROUTEd fraction _changed and set_ events.
>
> The fraction_changed event out is also connected to an HTML slider
(<input type=?range?>) via X3DOM?s onoutputchange() attribute.
>
> The HTML slider shows the progress of the animation, but I?d also like to
use it to control the fraction of the animation, much like one can scrub
through a video with a timeline slider.
>
> It seems that if I were able to set the fraction of the TimeSensor from
the HTML slider I could achieve my goal, but there is not a set_fraction
event in for it.
>
> Is there a best practice or any suggestions for how I may achieve my goal?
>
> Thanks in advance,
> Mike
>
> P.S. Though my immediate need is to implement this in X3DOM, I?d think
that this might be a common use case, so I?m cross-posting on x3d-public.
>
> --
> Mike McCann
> Software Engineer
> Monterey Bay Aquarium Research Institute
> 7700 Sandholdt Road
> Moss Landing, CA 95039-9644
> Voice: 831.775.1769 Fax: 831.775.1736 http://www.mbari.org
>
>
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org <mailto:x3d-public at web3d.org>
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org <
http://web3d.org/mailman/listinfo/x3d-public_web3d.org>
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20191214/644683a6/attachment-0001.html
>
>
> ------------------------------
>
> Message: 2
> Date: Sat, 14 Dec 2019 16:44:12 -0500
> From: "vmarchetti at kshell.com" <vmarchetti at kshell.com>
> To: Mike McCann <mccann at mbari.org>
> Cc: Joseph D Williams <joedwil at earthlink.net>, x3dom mlist
> <x3dom-users at lists.sourceforge.net>, X3D Graphics public mailing
list
> <x3d-public at web3d.org>
> Subject: Re: [x3d-public] HTML slider and TimeSensor scrubbing
> behavior
> Message-ID: <92904E9C-B23B-4B19-BE42-AA5F4F406C62 at kshell.com>
> Content-Type: text/plain; charset="utf-8"
>
> Mike
>
> This sounds similar to a scene I worked on at
http://www.kshell.com/pages/cmmpoc/index.html <
http://www.kshell.com/pages/cmmpoc/index.html> . I've got three sliders
feeding into 3 position interpolators,
> Because I load my x3d as an external file I have to run a javascript
after loading that looks through the DOM tree and finds those interpolators.
>
> But the relevant part for you I think, is to define a function which I
call "moveInterpolator" and to set it as the handler for the 'oninput'
method of the slider.
> You can see it in the source html for page
http://www.kshell.com/pages/cmmpoc/index.html <
http://www.kshell.com/pages/cmmpoc/index.html>
>
> Vince Marchetti
>
>
> On Dec 14, 2019, at 4:29 PM, Mike McCann <mccann at mbari.org> wrote:
>
> Hi Joe,
>
> Thanks for the memory jog. I recall doing it this way in pure VRML.
>
> What I can?t figure out is how to ?route? the output of the HTML slider
into X3DOM's Interpolators. Is there an attribute in the x3dom runtime that
I can set?
>
> -Mike
>
> On Dec 13, 2019, at 1:44 PM, Joseph D Williams <joedwil at earthlink.net
<mailto:joedwil at earthlink.net>> wrote:
>
> Hi Mike,
> Same as to do a slider control in x3d?
> You disconnect the TimeSensor and drive the Position and Orientation
Interpolators with a number you derive from the slider, I think.
> Joe
>
> From: Mike McCann <mailto:mccann at mbari.org>
> Sent: Friday, December 13, 2019 10:25 AM
> To: x3dom mlist <mailto:x3dom-users at lists.sourceforge.net>; X3D Graphics
public mailing list <mailto:x3d-public at web3d.org>
> Subject: [x3d-public] HTML slider and TimeSensor scrubbing behavior
>
> Hello,
>
> I have a TimeSensor that drives Position and Orientation Interpolators
via ROUTEd fraction _changed and set_ events.
>
> The fraction_changed event out is also connected to an HTML slider
(<input type=?range?>) via X3DOM?s onoutputchange() attribute.
>
> The HTML slider shows the progress of the animation, but I?d also like to
use it to control the fraction of the animation, much like one can scrub
through a video with a timeline slider.
>
> It seems that if I were able to set the fraction of the TimeSensor from
the HTML slider I could achieve my goal, but there is not a set_fraction
event in for it.
>
> Is there a best practice or any suggestions for how I may achieve my goal?
>
> Thanks in advance,
> Mike
>
> P.S. Though my immediate need is to implement this in X3DOM, I?d think
that this might be a common use case, so I?m cross-posting on x3d-public.
>
> --
> Mike McCann
> Software Engineer
> Monterey Bay Aquarium Research Institute
> 7700 Sandholdt Road
> Moss Landing, CA 95039-9644
> Voice: 831.775.1769 Fax: 831.775.1736 http://www.mbari.org <
http://www.mbari.org/>
>
>
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org <mailto:x3d-public at web3d.org>
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org <
http://web3d.org/mailman/listinfo/x3d-public_web3d.org>
>
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20191214/19fe265d/attachment.html
>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>
>
> ------------------------------
>
> End of x3d-public Digest, Vol 129, Issue 16
> *******************************************
>
>
>
>
> --
> Andreas Plesch
> Waltham, MA 02453
>
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>
>
--
Andreas Plesch
Waltham, MA 02453
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20191217/b4f6495e/attachment-0001.html>
More information about the x3d-public
mailing list