Pixi.js: Is it possible to dynamically change a bezier curve?

Created on 11 Jan 2017  路  2Comments  路  Source: pixijs/pixi.js

I have created a bezier curve using the PIXI.Graphics function bezierCurveTo()

The bezier curve end points are attached (or at least look like they are attached) to other sprites that can be dragged around the root container. When these sprites are dragged, the bezier curve remains in place.

Is it possible to dynamically change/update the points of a bezier curve, including the control points?

馃 Question

Most helpful comment

Hi @KosGrillis , this should be possible by calling, clearing the graphics object and redrawing the bezier curve each frame with the new control points.

render()
{
    myCurve.clear();
    myCurve.moveTo(x, y);
    myCurve. bezierCurveTo(cx, cy, cx2, cy2, newX, newY);

    renderer.render(scene)
}

hope that helps! Thanks!

All 2 comments

Hi @KosGrillis , this should be possible by calling, clearing the graphics object and redrawing the bezier curve each frame with the new control points.

render()
{
    myCurve.clear();
    myCurve.moveTo(x, y);
    myCurve. bezierCurveTo(cx, cy, cx2, cy2, newX, newY);

    renderer.render(scene)
}

hope that helps! Thanks!

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

trusktr picture trusktr  路  30Comments

KagiJPN picture KagiJPN  路  24Comments

andrevenancio picture andrevenancio  路  29Comments

SukantPal picture SukantPal  路  27Comments

winterNebs picture winterNebs  路  43Comments