objective c - Efficiently drawing and animating thousands of rectangles -
what trying have many small rectangles on screen (up several thousand) move randomly.
i have mechanics behind figured out (in terms of determining coordinates movement), can't figure out best way draw shapes or model movement.
a couple strategies have tried have been, first, subclass nsview (this on mac) , create thousands of these. change drawrect: function in order draw square inside of themselves. pretty simple change locations move them around. however, several thousand allocated instances of these, performance terrible.
i tried less object-oriented route also, using nsrectfill draw thousands of rectangles. however, had trouble implementing movement needed this, though blazing fast.
does have suggestions on how create animation?
layers , core animation best approach platform.
Comments
Post a Comment