0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-11-23 09:26:51 -05:00

update default render theme

This commit is contained in:
liabru 2020-12-08 23:14:20 +00:00
parent 13c7eb5492
commit d258411faa
2 changed files with 10 additions and 6 deletions

View file

@ -75,13 +75,15 @@ var Axes = require('../geometry/Axes');
render: { render: {
visible: true, visible: true,
opacity: 1, opacity: 1,
strokeStyle: null,
fillStyle: null,
lineWidth: null,
sprite: { sprite: {
xScale: 1, xScale: 1,
yScale: 1, yScale: 1,
xOffset: 0, xOffset: 0,
yOffset: 0 yOffset: 0
}, }
lineWidth: 0
}, },
events: null, events: null,
bounds: null, bounds: null,
@ -165,10 +167,12 @@ var Axes = require('../geometry/Axes');
}); });
// render properties // render properties
var defaultFillStyle = (body.isStatic ? '#2e2b44' : Common.choose(['#006BA6', '#0496FF', '#FFBC42', '#D81159', '#8F2D56'])), var defaultFillStyle = (body.isStatic ? '#14151f' : Common.choose(['#f19648', '#f5d259', '#f55a3c', '#063e7b', '#ececd1'])),
defaultStrokeStyle = '#000'; defaultStrokeStyle = body.isStatic ? '#555' : '#ccc',
defaultLineWidth = body.isStatic && body.render.fillStyle === null ? 1 : 0;
body.render.fillStyle = body.render.fillStyle || defaultFillStyle; body.render.fillStyle = body.render.fillStyle || defaultFillStyle;
body.render.strokeStyle = body.render.strokeStyle || defaultStrokeStyle; body.render.strokeStyle = body.render.strokeStyle || defaultStrokeStyle;
body.render.lineWidth = body.render.lineWidth || defaultLineWidth;
body.render.sprite.xOffset += -(body.bounds.min.x - body.position.x) / (body.bounds.max.x - body.bounds.min.x); body.render.sprite.xOffset += -(body.bounds.min.x - body.position.x) / (body.bounds.max.x - body.bounds.min.x);
body.render.sprite.yOffset += -(body.bounds.min.y - body.position.y) / (body.bounds.max.y - body.bounds.min.y); body.render.sprite.yOffset += -(body.bounds.min.y - body.position.y) / (body.bounds.max.y - body.bounds.min.y);
}; };

View file

@ -52,8 +52,8 @@ var Mouse = require('../core/Mouse');
width: 800, width: 800,
height: 600, height: 600,
pixelRatio: 1, pixelRatio: 1,
background: '#18181d', background: '#14151f',
wireframeBackground: '#0f0f13', wireframeBackground: '#14151f',
hasBounds: !!options.bounds, hasBounds: !!options.bounds,
enabled: true, enabled: true,
wireframes: true, wireframes: true,