Matter-js: How to change the star size?

Created on 1 Feb 2018  路  2Comments  路  Source: liabru/matter-js

Demo http://brm.io/matter-js/demo/#concave
I wanted to change the size of the stars, and I didn't find the corresponding size API.

Including the Bodies.FromVertices API, I introduced SVG as a terrain, but I didn't find the API to change the size.

Most helpful comment

For anyone interested in applying the Vertices.scale method using the demo provided above:

$(data).find('path').each(function(i, path) {
    vertexSets.push(Matter.Vertices.scale(Svg.pathToVertices(path), 1.25, 1.25));
});

// the Matter.Vertices.scale(vertices, scaleX, scaleY) is what does the scaling.
// the Svg.pathToVertices(path) is the vertice points
// the 1.25 is the scaling value

All 2 comments

I found it
Vertices.Scale.

For anyone interested in applying the Vertices.scale method using the demo provided above:

$(data).find('path').each(function(i, path) {
    vertexSets.push(Matter.Vertices.scale(Svg.pathToVertices(path), 1.25, 1.25));
});

// the Matter.Vertices.scale(vertices, scaleX, scaleY) is what does the scaling.
// the Svg.pathToVertices(path) is the vertice points
// the 1.25 is the scaling value
Was this page helpful?
0 / 5 - 0 ratings