Magia Posted October 1, 2019 Share Posted October 1, 2019 Hi all! I have something like this let spline = new PIXI.Graphics() .lineStyle(1, 0xaaaaaa, 1) .moveTo(100, 100) .lineTo(200, 200) .lineTo(100, 500); And I want to get all points like this let points = spline.geometry.points; let values = []; for (let i = 0; i < points.length; i += 2) { values.push({ x: points[i], y: points[i + 1] }); } But cycle doesn't work, because of this points.length Then I decided display points and points.length console.log("points: "); console.log(points); console.log("points.length = " + points.length); and what I see Then I tried to get just one (first element) console.log("first element"); console.log(points[0]); and.... I really don't understand what is it and how it works. Someone know, what it can be? ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted October 1, 2019 Share Posted October 1, 2019 1. output array or object is async thing , you see the future value, after updateBatches() 2. its in "shape.points", not just "points", its related to how shapes are structured in pixi, its pure architectural reason. Magia 1 Quote Link to comment Share on other sites More sharing options...
Magia Posted October 2, 2019 Author Share Posted October 2, 2019 20 hours ago, ivan.popelyshev said: 1. output array or object is async thing , you see the future value, after updateBatches() 2. its in "shape.points", not just "points", its related to how shapes are structured in pixi, its pure architectural reason. Hm hm, I see. I figured out that for my purpose I can use .currentPath.points Thanks! ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.