Updating the end points of a display.newLine object

Hi there,
I’m playing around with an example where I’m bouncing some lines around the screen that leave a trail as they go (a bit like the old windows mystify screensaver or the classic arcade game Qix)

I’ve looked at the latest Hot Cross Bunnies sample (as they manipulate lines to provide the elastic effect) and they’re animating the lines in the same way as I am - removing the lines from the group and then calling display.newLine each frame.

This seems wasteful to me and as I’m currently throwing about 200+ lines around per frame I’m worried about garbage collection / overheads etc. So my question is - Is it possible to just update the two endpoints of an existing line in the same way that you can adjust the size, scale, position of other shapes - that way I can create my lines once and then just animate them instead of having to recreate all my groups each frame?

I’ve searched the docs and forums but I can only see how to change the basic x,y position (which might map to the first end point) but not the “other” endpoint of the line - is this exposed through a table somewhere?

Can anyone offer any help or advice?

Thanks (in advance)

Jon…
[import]uid: 7901 topic_id: 10405 reply_id: 310405[/import]

No takers? [import]uid: 7901 topic_id: 10405 reply_id: 38221[/import]

no first remove and then create new [import]uid: 12482 topic_id: 10405 reply_id: 38222[/import]

8-(
Seems a little wasteful - shouldn’t be too hard to expose the data in a table or something - maybe in the future.

Thanks for responding.

Jon…
[import]uid: 7901 topic_id: 10405 reply_id: 38250[/import]

Further investigation (and a comment in the physics docs) seem to suggest that newLine (and I suspect newCircle) are actually implemented by drawing the line into a texture and then rendering it as a quad - can anyone with some “insider” knowledge actually confirm this?

If it’s the case then I can see why you can’t dynamically change the endpoints, but to be honest I’m a little surprised - I’ve have expected line drawing at least to be rendered using GL primitives?

Anyway - As it turned out when I started to expand on the effect I needed rotation around a centre point and it actually turned out very easy to use a unit length rectangle that is scaled and rotated to give the same effect without having to constantly re-create the lines, might be something to think about if someone else wants to create a more efficient animating line.

Jon… [import]uid: 7901 topic_id: 10405 reply_id: 38404[/import]