0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-12-26 13:49:01 -05:00

changed default render styles

This commit is contained in:
liabru 2017-01-17 23:55:40 +00:00
parent ace1a9f6aa
commit 719ad649fe
4 changed files with 15 additions and 8 deletions

View file

@ -80,7 +80,7 @@ var Axes = require('../geometry/Axes');
xOffset: 0, xOffset: 0,
yOffset: 0 yOffset: 0
}, },
lineWidth: 1.5 lineWidth: 0
} }
}; };
@ -152,7 +152,7 @@ var Axes = require('../geometry/Axes');
}); });
// render properties // render properties
var defaultFillStyle = (body.isStatic ? '#eeeeee' : Common.choose(['#556270', '#4ECDC4', '#C7F464', '#FF6B6B', '#C44D58'])), var defaultFillStyle = (body.isStatic ? '#2e2b44' : Common.choose(['#006BA6', '#0496FF', '#FFBC42', '#D81159', '#8F2D56'])),
defaultStrokeStyle = Common.shadeColor(defaultFillStyle, -20); defaultStrokeStyle = Common.shadeColor(defaultFillStyle, -20);
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;

View file

@ -60,7 +60,7 @@ var Common = require('../core/Common');
var render = { var render = {
visible: true, visible: true,
lineWidth: 2, lineWidth: 2,
strokeStyle: '#666' strokeStyle: '#ffffff'
}; };
constraint.render = Common.extend(render, constraint.render); constraint.render = Common.extend(render, constraint.render);

View file

@ -275,14 +275,20 @@ var Bodies = require('./Bodies');
bodyA: body, bodyA: body,
pointA: { x: wheelAOffset, y: wheelYOffset }, pointA: { x: wheelAOffset, y: wheelYOffset },
bodyB: wheelA, bodyB: wheelA,
stiffness: 0.2 stiffness: 0.2,
render: {
lineWidth: 0
}
}); });
var axelB = Constraint.create({ var axelB = Constraint.create({
bodyA: body, bodyA: body,
pointA: { x: wheelBOffset, y: wheelYOffset }, pointA: { x: wheelBOffset, y: wheelYOffset },
bodyB: wheelB, bodyB: wheelB,
stiffness: 0.2 stiffness: 0.2,
render: {
lineWidth: 0
}
}); });
Composite.addBody(car, body); Composite.addBody(car, body);

View file

@ -52,7 +52,7 @@ var Mouse = require('../core/Mouse');
width: 800, width: 800,
height: 600, height: 600,
pixelRatio: 1, pixelRatio: 1,
background: '#fafafa', background: '#18181d',
wireframeBackground: '#0f0f13', wireframeBackground: '#0f0f13',
hasBounds: !!options.bounds, hasBounds: !!options.bounds,
enabled: true, enabled: true,
@ -892,12 +892,13 @@ var Mouse = require('../core/Mouse');
if (options.wireframes) { if (options.wireframes) {
c.strokeStyle = 'indianred'; c.strokeStyle = 'indianred';
c.lineWidth = 1;
} else { } else {
c.strokeStyle = 'rgba(0,0,0,0.8)'; c.strokeStyle = 'rgba(255, 255, 255, 0.4)';
c.globalCompositeOperation = 'overlay'; c.globalCompositeOperation = 'overlay';
c.lineWidth = 2;
} }
c.lineWidth = 1;
c.stroke(); c.stroke();
c.globalCompositeOperation = 'source-over'; c.globalCompositeOperation = 'source-over';
}; };