javalang Posted September 12, 2017 Share Posted September 12, 2017 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); ... }) Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted September 12, 2017 Share Posted September 12, 2017 What is the texture size? Also, its better to use TilingSprite for that case, and REPEAT will add performance to it. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted September 12, 2017 Share Posted September 12, 2017 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. Quote Link to comment Share on other sites More sharing options...
javalang Posted September 12, 2017 Author Share Posted September 12, 2017 @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? ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted September 12, 2017 Share Posted September 12, 2017 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 javalang 1 Quote Link to comment Share on other sites More sharing options...
javalang Posted September 12, 2017 Author Share Posted September 12, 2017 I understand, I will test it. BTW , better java/kotlin/scala than FORTRAN But, since I changed to javascript, i will never change to java again, I should change the Nic to something like 'javascriptfunction' Quote Link to comment Share on other sites More sharing options...
javalang Posted September 12, 2017 Author Share Posted September 12, 2017 @ivan.popelyshev So the short answer is: this.sprite.tileTransform.rotation = props.rotation * Math.PI / 180; and it works , thank you ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.