diff --git a/app.js b/app.js index 4c9ffff9..08b4859d 100644 --- a/app.js +++ b/app.js @@ -329,6 +329,7 @@ const script = { "mode/cam/slice", "mode/cam/prepare", "mode/cam/export", + "mode/cam/animate", "mode/laser/driver", "kiri/widget", "kiri/print", diff --git a/src/kiri/worker.js b/src/kiri/worker.js index 5440ee07..d5a603cf 100644 --- a/src/kiri/worker.js +++ b/src/kiri/worker.js @@ -17,7 +17,7 @@ self.alert = function(o) { console.log(o); }; -console.log(`kiri | init work | ${KIRI.version}`); +console.log(`kiri | init work | ${KIRI.version || "rogue"}`); BASE.debug.disable(); // code is running in the worker / server context diff --git a/src/mode/cam/animate.js b/src/mode/cam/animate.js index 84de5f7a..419a4eb4 100644 --- a/src/mode/cam/animate.js +++ b/src/mode/cam/animate.js @@ -2,7 +2,7 @@ "use strict"; -(function() { +kiri.loader.push(function() { let KIRI = self.kiri, BASE = self.base, @@ -11,6 +11,7 @@ newPolygon = BASE.newPolygon, newPoint = BASE.newPoint; + if (KIRI.client) CAM.animate = function(API) { const settings = API.conf.get(); const stock = settings.stock; @@ -18,9 +19,9 @@ console.log("animate", settings.stock); - const step = 2; - const stepsX = Math.floor(stock.x / step); - const stepsY = Math.floor(stock.y / step); + const step = 1; + const stepsX = Math.floor(stock.x / step) + 1; + const stepsY = Math.floor(stock.y / step) + 1; const gridPoints = stepsX * stepsY; const mat = new THREE.LineBasicMaterial({ @@ -30,9 +31,9 @@ }); const pos = new Float32Array(gridPoints * 3); - const ind = [];//new Array(stepsX * stepsY); - const ox = (stepsX * step) / 2; - const oy = (stepsY * step) / 2; + const ind = []; + const ox = stock.x / 2; + const oy = stock.y / 2; // initialize grid points for (let x=0, ai=0; x { + console.log('client.animate.results', reply); + }); + }; + + if (KIRI.worker) + KIRI.worker.animate = function(data, send) { + console.log('worker.animate', data); + send.done({def:456}); + }; + +});