Sign in to follow this  
Magia

Something strange with PIXI.Graphics / .geometry.points

Recommended Posts

Hi all!

I have something like this
 

   let spline = new PIXI.Graphics()
      .lineStyle(10xaaaaaa1)
      .moveTo(100100)
      .lineTo(200200)
      .lineTo(100500);

And I want to get all points like this

let points = spline.geometry.points;
 let values = [];
 
  for (let i = 0i < points.lengthi += 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

image.png.03736aa096df0c17a47366bfb8f3146e.png

Then I tried to get just one (first element)

    console.log("first element");
    console.log(points[0]);

and....

image.png.245ac7404bd5ed73895a16282b255cb1.png

I really don't understand what is it and how it works.
Someone know, what it can be?

 

 

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.