From 607f69c67a5b4dc72d2754192e3cdf67d0ad11d0 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 3 Jun 2014 16:24:10 -0400 Subject: partitioning client and serveR --- .../environments/tableaux/columns_split.js | 63 ++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 client/assets/javascripts/environments/tableaux/columns_split.js (limited to 'client/assets/javascripts/environments/tableaux/columns_split.js') diff --git a/client/assets/javascripts/environments/tableaux/columns_split.js b/client/assets/javascripts/environments/tableaux/columns_split.js new file mode 100644 index 0000000..b9981d6 --- /dev/null +++ b/client/assets/javascripts/environments/tableaux/columns_split.js @@ -0,0 +1,63 @@ +MX.Tableaux.ColumnsSplit = MX.Tableau.extend({ + + init: function (opt) { + + this.opt = opt = defaults(opt, { + width: 100, + height: 100, + depth: 100, + norm: 0.5, + gap: 5, + x: 0, + y: 0, + z: 0, + rotationY: 0, + scale: 1, + count: 1, + }) + + opt.colorBottom = opt.colorBottom || opt.color + + if ( ! (opt.norm instanceof Array) ) { + opt.norm = [ opt.norm, opt.norm ] + } + + var norm, spacingX, spacingZ, scalebox + + for (var i = 0; i < opt.count; i++) { + + norm = lerp( i/(opt.count-1), opt.norm[0], opt.norm[1] ) + + spacingX = opt.spacingX * i + spacingZ = opt.spacingZ * i + + scalebox = new MX.ScaleBox({ + "width": opt.width, + "height": opt.height * norm, + "depth": opt.depth, + "x": opt.x + spacingX, + "y": opt.y + opt.gap, + "z": opt.z + spacingZ, + "color": opt.color, + "sides": "top bottom left right front back", + "rotationY": opt.rotationY, + }); + scene.add(scalebox) + + scalebox = new MX.ScaleBox({ + "width": opt.width, + "height": opt.height * (1 - norm), + "depth": opt.depth, + "x": opt.x + spacingX, + "y": opt.y - opt.height * (1 - norm) - opt.gap, + "z": opt.z + spacingZ, + "color": opt.colorBottom, + "sides": "top bottom left right front back", + "rotationY": opt.rotationY, + }); + scene.add(scalebox) + } + + } + +}) -- cgit v1.2.3-70-g09d2