[x3d-public] dynamic cycleInterval changes

Holger Seelig holger.seelig at yahoo.de
Mon Nov 21 06:26:45 PST 2016


It should be possible to do:

timeSensor .stopTime = time;
timeSensor .cycleInterval = t;
timeSensor .startTime = time;

Holger


Am 20.11.2016 um 21:36 schrieb Andreas Plesch:
> I want to change the cycleTime of a TimeSensor in a x3d script:
>
> https://raw.githubusercontent.com/andreasplesch/cobweb_dom/master/tests/dynamicCycleTime.x3d
>
> cycleTime input events are ignored when the TimeSensor is enabled. So it
> is necessary to disable it first, then change the cycleTime and then
> reenable it.
>
> However, in all tested browser the above does not work as expected.
> These are cobweb, instant player and bs contact. bs contact also has
> this console message:
> Script node speeder: parse error: line 16 "time.cycleInterval = 2;" ()
> and therefore does not get to change the color to grey.
> The javascript sai does not have a SFTime constructor and allows numbers.
>
> cobweb and instant player change the color but do not slow down the ball.
> I first thought that cobweb does not correctly work through the sequence
> of events but since no browser works sofar I start to think that I am
> missing something.
>
> Any help or feedback appreciated,
>
> -Andreas
>
> On Sat, Nov 19, 2016 at 8:39 PM, Andreas Plesch <andreasplesch at gmail.com
> <mailto:andreasplesch at gmail.com>> wrote:
>
>     Hi Roy,
>
>     Here is a cobweb version of the updated example:
>
>     https://rawgit.com/andreasplesch/cobweb_dom/master/tests/html5/cobweb_integration2.html
>     <https://rawgit.com/andreasplesch/cobweb_dom/master/tests/html5/cobweb_integration2.html>
>
>     I removed all features which are only supported by or necessary for
>     the x3dom version.
>
>     The main necessary changes were:
>
>     - use setAttribute on DOM elements rather than DOM element
>     properties because cobweb does not create these properties. x3dom
>     allows for using setAttribute() in addition to setting properties.
>
>     - use a TouchSensor node to enable clicking on the ball instead of
>     the onclick attribute. Cobweb ignores the onclick attribute and
>     x3dom ignores the touch sensor. In Cobweb the TouchSensor generates
>     and is the target of a dom event ('x3d_touchTime') which can be
>     received by an installed listener. The .addEventListener() call does
>     this.
>
>     - modify the scale attribute of the enclosing transform instead of
>     the radius attribute of the sphere since radius is not recognized as
>     an input field in Cobweb as it interprets the spec. this way.
>
>     I also looked more closely into why I had to introduce a timeout
>     delay to make the TimeSensor cycleInterval change have an effect. It
>     turns that there were multiple reasons. Interestingly, the first
>     reason had to do with how the DOM spec. defines Mutation Observers
>     and I filed a spec. issue:
>     https://github.com/whatwg/dom/issues/376
>     <https://github.com/whatwg/dom/issues/376>
>     In effect, the enabled='false' mutation was not reported fully. I
>     could fix this in cobweb_dom, so it was a worthy investigation.
>     Also interestingly, the second reason had to with how cobweb
>     processes input events. From what I understand first fields get
>     tainted and are then processed in the cascade. I think the second
>     set_enabled event occurred before the first had a chance to be
>     processed and reset the target value back. This was also possible to
>     fix in cobweb_dom by forcing processing after each mutation (input
>     event).
>
>     As a result, the delay is not necessary anymore and the sequence
>     works as expected.
>
>     -Andreas
>
>     On Sat, Nov 12, 2016 at 5:48 AM, Roy Walmsley
>     <roy.walmsley at ntlworld.com <mailto:roy.walmsley at ntlworld.com>> wrote:
>
>         Hi Andreas,____
>
>         __ __
>
>         Having a Cobweb version is great. Thank you very much.____
>
>         __ __
>
>         You’re comments are also interesting. Lots of food for thought.
>         I will modify both examples to illustrate using X3D output
>         events as well, as I have completely missed that feature. I’ll
>         also modify the titles to include the implementation, and put
>         both on the web site.____
>
>         __ __
>
>         Regards,____
>
>         __ __
>
>         Roy____
>
>         __ __
>
>         *From:*Andreas Plesch [mailto:andreasplesch at gmail.com
>         <mailto:andreasplesch at gmail.com>]
>         *Sent:* 12 November 2016 01:19
>         *To:* Roy Walmsley <roy.walmsley at ntlworld.com
>         <mailto:roy.walmsley at ntlworld.com>>
>         *Cc:* X3D Graphics Working Group <x3d at web3d.org
>         <mailto:x3d at web3d.org>>
>         *Subject:* Re: X3D / DOM integration example using X3DOM____
>
>         __ __
>
>         Hi Roy,____
>
>         this is a nice example, demonstrating main integration features.____
>
>         I modified it to work with cobweb_dom:____
>
>         https://rawgit.com/andreasplesch/cobweb_dom/master/tests/html5/cobweb_integration.html
>         <https://rawgit.com/andreasplesch/cobweb_dom/master/tests/html5/cobweb_integration.html>____
>
>         This should also still work mostly unchanged with x3dom although
>         it looks perhaps quite different.____
>
>         The main necessary changes were:____
>
>         - use setAttribute on DOM elements rather than DOM element
>         properties because cobweb does not create these properties.
>         x3dom allows for using setAttribute.____
>
>         - use a TouchSensor node to enable clicking on the ball instead
>         of the onclick attribute. Cobweb ignores the onclick attribute
>         and x3dom ignores the touch sensor.____
>
>         - introduce a small delay after disabling the time sensor to
>         make sure it is actually disabled when the cycle interval is set
>         in an input event. This looks like it should not be necessary to
>         do, so will require some investigation.____
>
>         - modify the scale attribute instead of the radius attribute
>         since radius is not an input field. Cobweb follows the spec.
>         strictly, x3dom is more liberal. Radius should become an input
>         field.____
>
>         So two questions emerge:____
>
>         Should DOM element properties be required? No, in my opinion,
>         since attributes are the more fundamental component and
>         definitely required in the XML encoding. It is probably possible
>         to have another layer which translates attributes into
>         properties and back.____
>
>         Which x3d output events should be exposed and how ? Following
>         x3d conventions (TouchSensor) or following DOM event conventions
>         (click) ? Undecided, leaning towards x3d, perhaps both. x3dom
>         and Cobweb expose all output events, x3dom with outputchange and
>         Cobweb with x3d_eventname.
>         (It would be probably possible to implement click and other dom
>         event dispatchers by adding sensor nodes to the scene graph but
>         not to the dom tree).____
>
>         Andreas ____
>
>         __ __
>
>         On Fri, Nov 11, 2016 at 10:13 AM, Roy Walmsley
>         <roy.walmsley at ntlworld.com <mailto:roy.walmsley at ntlworld.com>>
>         wrote:____
>
>             Hi all,____
>
>             ____
>
>             Following Wednesday’s open meeting I have put together an
>             example that illustrates the integration of an X3D scene
>             into an HTML web page, that also incorporates SVG. It
>             includes events, both X3D and HTML. There is also
>             interaction between X3D, SVG, and HTML in multiple
>             directions.____
>
>             ____
>
>             The intention was to provide a simple (but not high
>             quality!) example to facilitate thinking about specification
>             requirements.____
>
>             ____
>
>             Sorry that I couldn’t put the example directly onto one of
>             our web pages. But it should be easy for you to copy and
>             paste to create your own file and open it up in a browser.
>             The only browser that’s failed me so far is Safari.____
>
>             ____
>
>             Here’s the link:
>             http://www.web3d.org/member/wiki/x3d-svg-html-dom-integration-example-using-x3dom
>             <http://www.web3d.org/member/wiki/x3d-svg-html-dom-integration-example-using-x3dom>____
>
>             ____
>
>             Have fun,____
>
>             ____
>
>             Roy____
>
>             ____
>
>             PS As it came up on Wednesday I have also added an HTML
>             slider, demonstrating instant updating.____
>
>
>
>         ____
>
>         __ __
>
>         -- ____
>
>         Andreas Plesch
>         39 Barbara Rd.
>         Waltham, MA 02453____
>
>
>
>
>     --
>     Andreas Plesch
>     39 Barbara Rd.
>     Waltham, MA 02453
>
>
>
>
> --
> Andreas Plesch
> 39 Barbara Rd.
> Waltham, MA 02453
>
>
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>


-- 
Holger Seelig
Mediengestalter Digital – Digital Media Designer

Scheffelstraße 31a
04277 Leipzig
Germany

Cellular: +49 1577 147 26 11
E-Mail:   holger.seelig at create3000.de
Web:      http://titania.create3000.de

Future to the fantasy ★ ★



More information about the x3d-public mailing list