var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; var escapeMarkup = require('../../behavior-scene/util').escapeMarkup; var xmlCode = escapeMarkup(` `); var jsCode = ` ...
addOne() {
const xrFrameSystem = wx.getXrFrameSystem();
const pos = [Math.random(), Math.random(), Math.random()].map(v => (v * 2 - 1) * 6);
const gltfElement = this.scene.createElement(xrFrameSystem.XRGLTF);
this.shadowRoot.addChild(gltfElement);
gltfElement.getComponent(xrFrameSystem.Transform).position.setArray(pos);
gltfElement.getComponent(xrFrameSystem.GLTF).setData({model: this.gltfModle});
this.meshList.push(gltfElement);
}, removeOne() {
const element = this.meshList.pop();
if (element) {
this.shadowRoot.removeChild(element); }
}, handleTick: function({detail}) {
const {el, value} = detail;
},
... `; Page({ behaviors:[sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
', jsCode: jsCode, meshCount: 0 }, handleIncMeshCount: function() { if (this.data.meshCount > 16) { return; } this.setData({meshCount: this.data.meshCount + 1}); }, handleDecMeshCount: function() { if (this.data.meshCount <= 0) { return; } this.setData({meshCount: this.data.meshCount - 1}); } });