Skip to content

Commit 4c27064

Browse files
author
Ib Green
committed
Add rotation parameter to example
1 parent 70e4b7e commit 4c27064

4 files changed

Lines changed: 35 additions & 181 deletions

File tree

example/app.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,8 @@ class ExampleApp extends React.Component {
229229
hoverChoropleth: null,
230230
clickItem: null,
231231
settings: {
232-
separation: 0
232+
separation: 0,
233+
rotation: 0
233234
}
234235
};
235236

@@ -386,7 +387,7 @@ class ExampleApp extends React.Component {
386387
}
387388

388389
_renderExamples() {
389-
const {settings: {separation}} = this.state;
390+
const {settings: {separation, rotation}} = this.state;
390391
const props = {
391392
...this.props,
392393
...this.state,
@@ -427,10 +428,11 @@ class ExampleApp extends React.Component {
427428
// Generate common props
428429
index++;
429430
// const modelMatrix = new Matrix4().fromTranslation([0, 0, 1000 * index * separation]);
430-
layerProps.modelMatrix =
431+
const modelMatrix =
431432
mat4.fromTranslation(mat4.create(), [0, 0, 300 * index * separation, 0]);
433+
mat4.rotateZ(modelMatrix, modelMatrix, index * rotation * Math.PI / 10000);
432434
console.log(layerProps.modelMatrix); // eslint-disable-line
433-
435+
Object.assign(layerProps, {modelMatrix});
434436
/* eslint-enable max-depth */
435437
layers.push(example(layerProps));
436438
}

example/layer-controls.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export default class LayerControls extends Component {
4444
<div className="layer-controls" style={{marginTop: 0, padding: 0, width: 270}}>
4545
<h4>Layer Controls</h4>
4646
{this._renderSlider('separation', {}, settings.separation, 'Separation')}
47+
{this._renderSlider('rotation', {}, settings.rotation, 'Rotation')}
4748
</div>
4849
);
4950
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"gl": "^4.0.2",
6464
"highlight.js": "^9.7.0",
6565
"immutable": "^3.7.5",
66-
"luma.gl": "^2.10.3",
66+
"luma.gl": "3.0.0-alpha2",
6767
"marked": "^0.3.6",
6868
"react": "^15.3.2",
6969
"react-addons-test-utils": "^15.0.2",
@@ -84,7 +84,7 @@
8484
"uglify-js": "^2.6.1"
8585
},
8686
"peerDependencies": {
87-
"luma.gl": "^2.10.3",
87+
"luma.gl": "3.0.0-alpha2",
8888
"react": "0.14.x - 15.x",
8989
"react-dom": "0.14.x - 15.x"
9090
},

0 commit comments

Comments
 (0)