[x3d-public] Don, Re: ECMAScript 6 SAI proposal (simple for now).

John Carlson yottzumm at gmail.com
Thu May 7 00:35:37 PDT 2020


see app.mjs module for an example of using the ES6 SAI prototype.   x3d.mjs
is the module  library.  I'm following on x3d.py's lead!

Will integrate X3DJSAIL with Node.js when you provide a list of public
facing SAI classes beyond X3DUOM.

Code is also here:

https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/es6/


The main points for using ES6 is classes/modules/export/import.

Thanks,

John

On Thu, Apr 30, 2020 at 9:06 AM John Carlson <yottzumm at gmail.com> wrote:

> Here is another place to pick up the library:
>
> http://coderextreme.net/es6.zip
>
> I need some examples!
>
> Suggest possibly modifying ECMAScript SAI examples.
>
> John
>
> On Thu, Apr 30, 2020 at 8:53 AM John Carlson <yottzumm at gmail.com> wrote:
>
>> Mostly just construction right now.  I'm not quite sure how to do
>> protos.  Below is the first example.
>>
>> Code is here:
>> https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/es6 (if
>> you can access it.  I can't right now).
>>
>> Comments?
>>
>> John
>>
>>
>> $ cat app.mjs
>> "use strict"
>>
>> import X3D from './x3d.mjs';
>> import { head, meta, Scene, Transform, Group, Material, Shape, Box,
>> Appearance } from './x3d.mjs';
>> import { MFNode, SFColor, SFVec3f, SFRotation } from './x3d.mjs';
>>
>> var x3d = new X3D({
>>         head : new head({
>>                 meta : [
>>                         new meta({
>>                                 name : "John W",
>>                                 content : "Carlson, I"
>>                         }),
>>                         new meta({
>>                                 name : "John A",
>>                                 content : "Carlson, II"
>>                         }),
>>                         new meta({
>>                                 name : "John R",
>>                                 content : "Carlson, III"
>>                         })
>>                 ]
>>         }),
>>         Scene : new Scene({
>>                 children : new MFNode([
>>                         new Group({
>>                                 children : new MFNode([
>>                                         new Shape({
>>                                                 appearance : new
>> Appearance({
>>                                                         material : new
>> Material({
>>
>> diffuseColor : new SFColor([1, 0, 0])
>>                                                         })
>>                                                 }),
>>                                                 geometry : new Box()
>>                                         })
>>                                 ])
>>                         }),
>>                         new Transform({
>>                                 translation : new SFVec3f([1, 2, 3]),
>>                                 scale: new SFVec3f([4, 5, 6]),
>>                                 rotation: new SFRotation([7, 8, 9, 3.14])
>>                         })
>>                 ])
>>         })
>> })
>>
>> console.log(x3d.toXMLNode());
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20200507/76a5afab/attachment-0001.html>


More information about the x3d-public mailing list