Sign in to follow this  
lunarovich

.getLocalBounds() and .toLocal() speed up animation at least 2x

Recommended Posts

Hello! A curious thing happens when I try to get the localBounds of the sprite in every tick. The animation speeds up considerably. A simple

this.sprite.getLocalBounds();

 in every tick is a culprit.

 

Also, when I try to read translated local coordinates of the sprite, the animation is even faster. I have a wrapper object around a PIXI.Sprite. The animation acceleration happens when I do this in every tick:

return A_.level.container.toLocal(A_.level.origin, this.sprite);

where the level origin is a simple PIXI.Point set to (0, 0) and container is a PIXI.DisplayObject. (A_. is a namespace wrapper around my library.)

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.