Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: PIXI.Graphics method lineTo at later call different #10239

Open
gohxc opened this issue Feb 22, 2024 · 0 comments
Open

Bug: PIXI.Graphics method lineTo at later call different #10239

gohxc opened this issue Feb 22, 2024 · 0 comments

Comments

@gohxc
Copy link

gohxc commented Feb 22, 2024

Current Behavior

image

Expected Behavior

Hope to be consistent

Steps to Reproduce

This is my code.

https://www.pixiplayground.com/#/edit/TicuUam_jZ3pfDLDAcXdD

`
function polygon_out(R) {
let r = [];
for (let i = 0; i <= 180; i += 10) {
let x = Math.cos(i / 180 * Math.PI) * R;
let y = Math.sin(i / 180 * Math.PI) * R;
r.push({
x,
y
});
}
return r;
}

const app = new PIXI.Application({
width: window.innerWidth,
height: window.innerHeight,
backgroundColor: 0x2c3e50
});
document.body.appendChild(app.view);

draw1();
draw2();
function draw1() {
const g = new PIXI.Graphics();
g.lineStyle(5, 0xFF00FF);
g.x = 400;
g.y = 50;
app.stage.addChild(g);
const points = polygon_out(200);
let p = points.shift();
g.moveTo(p.x, p.y);

while (points.length > 0) {
    let p = points.shift();
    g.lineTo(p.x, p.y);
}

}

function draw2() {
const g = new PIXI.Graphics();
g.lineStyle(5, 0xFF00FF);
g.x = 400;
g.y = 400;
app.stage.addChild(g);
const points = polygon_out(200);
let p = points.shift();
g.moveTo(p.x, p.y);

app.ticker.add((delta) => {
    if (points.length > 0) {
        let p = points.shift();
        g.lineTo(p.x, p.y);
    }

});

}
`
draw1 and draw2 different .

Environment

  • pixi.js version: e.g. 7.4.0
  • Browser & Version: e.g. Chrome 108
  • OS & Version: e.g. Windows 11
  • Running Example: e.g. https://pixiplayground.com/

Possible Solution

No response

Additional Information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant