Quantcast
Channel: Pixi.js Latest Topics
Viewing all articles
Browse latest Browse all 3981

Scroll/clip rect in pixijs

$
0
0

Hi All,

 

I have a quick question that ive been battling with for most of the day, is there an easy way to create a "scrollRect" for a pixi graphics object? I mean something along the lines of:

 

myGraphics.scrollRect = new Rectangle(10, 10, 100, 100);

 

That would then basically clip the while display object from x=10, y=10, cx=100, cy=100. Masks seem complete overkill here and really hard to manage, as when you move the graphics object you also have to move the mask... unless im mistaken? It seemed that the mask couldnt be added to the actual graphics object and thus its position was all out of sync with the display object. Is this something that exists but i just couldnt find it?

 

In the above example, if you move the display object to, say, 300x300 then the clip rect would be unaffected. Ive also thought that i might be able to implement this by creating a new texture of itself and drawing that based on the clip rect, i havent tried this and this may work, but it seems expensive and figured i would ask incase there is a much simpler method.

 

Thanks in advance,

Ian


Viewing all articles
Browse latest Browse all 3981

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>