Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

PIXI.WRAP_MODES.REPEAT not working?


javalang
 Share

Recommended Posts

Hello, I'm asking because I'm not sure of my understanding  the  PIXI.basetexture WRAP_MODES:

For example:  given one container, one texture (loaded with loader) and one smaller sprite, defining PIXI.WRAP_MODES.REPEAT should fill the whole container, but it doesn't.

The following code shows a sprite inbetween the container without repeating, what I'm doing wrong ? see WRAPMODE_TEST_HERE

Thanks in advance

PS: using PIXI 4.5.5

loader.load((loader, ressources) => {
    var texture = ressources.rgba.texture;
    texture.baseTexture.wrapMode = PIXI.WRAP_MODES.REPEAT;
    var sprite = new PIXI.Sprite(texture);
    sprite.width = 312
    sprite.height = 312
    stage.addChild(sprite);
...
})

 

Link to comment
Share on other sites

In general, REPEAT is passed to WebGL, it does not affect stage tree. However there are some cases where it also can be used, like DisplacementFilter. Its not possible to understand its logic and why certain elements can be affected by it, unless you start working with WebGL directly.

Link to comment
Share on other sites

@ivan.popelyshev thanks for reply, TilingSprite is not suitable for me because my scale factors are not whole numbers.

I added a link of the testcase in the first thread .

So you think I should implement the repeat function for example in a filter?

 

Edit: Changed my scenario to TilingSprite, using tileScale and tilePosition works fine now, but how to rotate?

Link to comment
Share on other sites

That's one of features I had add to TilingSprite personally :)

Look closer at https://github.com/pixijs/pixi.js/blob/dev/src/extras/TilingSprite.js#L116 , TilingSprite have actual transform on the inside! You can specify not only position and scale but also other things!

You might want to synchronize it with some other container to create elements that will live "on top" of that tilingSprite.

Btw, nice nickname! I'm also java/scala/kotlin developer ^_^ 

 

Link to comment
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...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...