[x3d-public] ECMAScript

Joseph D Williams joedwil at earthlink.net
Sun Aug 6 13:31:06 PDT 2023


Hi, view3dscene, missing ECMAScript. 
Near implementation?
All I need is some basic stuff. : 

DEF PositionData Script {
  outputOnly MFString position 
  inputOnly SFVec3f printPosition
  initializeOnly SFString sep ", "
  url "ecmascript: 
    function printPosition (value,ts) {
      var x = Math.round(value.x*100)/100; // simple 2 decimal digits
      var y = Math.round(value.y*100)/100;
      var z = Math.round(value.z*100)/100;
      position = new MFString ( x + sep + y + sep + z );
    }
  "
}

DEF OrientationData Script {
  outputOnly MFString orientation 
  inputOnly SFRotation printOrientation
  initializeOnly SFString sep ", "
  url "ecmascript: 
    function printOrientation (value,ts) {
      var x = Math.round(value.x*100)/100;
      var y = Math.round(value.y*100)/100;
      var z = Math.round(value.z*100)/100;
      var angle = Math.round(value.angle*100)/100;
      orientation = new MFString ( x + sep + y + sep + z + sep + angle );
    }
  "
}

Thanks, 
Joe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20230806/db125f96/attachment.html>


More information about the x3d-public mailing list