Jump to content

Aspect ratio on repeating rope texture


Recommended Posts

I'm sure I'm missing something simple here, but I can't seem to make a rope with a repeating texture that isn't an aspect ratio of 1:1. Here's my sample code, based on the "Hello World" example:

<!doctype html>
  <meta charset="utf-8">
  <title>Hello World</title>
  <script src="pixi.min.js"></script>
  <script type="text/javascript">
    let type = "WebGL"
      type = "canvas"

    PIXI.utils.sayHello(type); //    PixiJS 5.2.4 - ✰ WebGL ✰      http://www.pixijs.com/    ♥♥♥ 

    const loader = PIXI.Loader.shared;

    let app = new PIXI.Application({width: 512, height: 512, antialias: true});

    loader.add("wall","uglywall2.png"); // 128px wide, 64px tall
    function setup() {
      let walltex = loader.resources.wall.texture;
      let tsprite = new PIXI.TilingSprite(walltex,400,64);
      tsprite.x = 50;
      tsprite.y = 50;

      let tropepoints = [new PIXI.Point(50,200), new PIXI.Point(450,200)];
      let trope = new PIXI.SimpleRope(walltex,tropepoints, 1);
      walltex.baseTexture.wrapMode = PIXI.WRAP_MODES.REPEAT;


I've attached a screenshot of the results. What I would expect is that the two objects appear identical, but the rope's texture gets "squashed" instead. What noob mistake am I making?


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.

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.


  • Recently Browsing   0 members

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