avocado-old/packages/physics/index.js
2019-03-24 19:11:45 -05:00

27 lines
538 B
JavaScript

export {BodyView} from './body-view';
import {PolygonShape} from './polygon';
export {PolygonShape};
import {RectangleShape} from './rectangle';
export {RectangleShape};
import {ShapeList} from './list';
export {ShapeList};
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);
}