avocado-old/packages/physics/index.js

29 lines
579 B
JavaScript
Raw Normal View History

2019-03-24 18:58:32 -05:00
export {BodyView} from './body-view';
2019-03-22 11:25:20 -05:00
import {PolygonShape} from './polygon';
export {PolygonShape};
import {RectangleShape} from './rectangle';
export {RectangleShape};
import {ShapeList} from './list';
export {ShapeList};
2019-03-28 02:39:04 -05:00
export {ShapeView} from './shape-view';
2019-03-22 11:25:20 -05:00
export function shapeFromJSON(json) {
let shape;
switch (json.type) {
case 'list':
shape = new ShapeList();
break;
case 'polygon':
shape = new PolygonShape();
break;
case 'rectangle':
shape = new RectangleShape();
break;
}
return shape.fromJSON(json);
}