<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Prabhjot Singh</title>
    <description>The latest articles on DEV Community by Prabhjot Singh (@prabhjot_singh_f21d46cc91).</description>
    <link>https://dev.to/prabhjot_singh_f21d46cc91</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3133699%2Fd6f3fdf5-fd48-43f9-a823-a521216ca112.png</url>
      <title>DEV Community: Prabhjot Singh</title>
      <link>https://dev.to/prabhjot_singh_f21d46cc91</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/prabhjot_singh_f21d46cc91"/>
    <language>en</language>
    <item>
      <title>Create Infinite Scrolling Backgrounds in PixiJS (TilingSprite Tutorial)</title>
      <dc:creator>Prabhjot Singh</dc:creator>
      <pubDate>Thu, 15 Jan 2026 04:34:49 +0000</pubDate>
      <link>https://dev.to/prabhjot_singh_f21d46cc91/create-infinite-scrolling-backgrounds-in-pixijs-tilingsprite-tutorial-3bc9</link>
      <guid>https://dev.to/prabhjot_singh_f21d46cc91/create-infinite-scrolling-backgrounds-in-pixijs-tilingsprite-tutorial-3bc9</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;One of the most common mechanics in 2D games—especially endless runners and space shooters—is the &lt;strong&gt;infinite scrolling background&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If you are using &lt;strong&gt;PixiJS&lt;/strong&gt;, you might be tempted to create two sprites and move them manually to create the illusion of movement. However, PixiJS provides a specific, performance-optimized tool for this exact purpose: the &lt;strong&gt;TilingSprite&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In this tutorial, we will learn how to set up a TilingSprite and animate it to create a seamless loop.&lt;/p&gt;

&lt;h2&gt;
  
  
  📺 Watch the Video Tutorial
&lt;/h2&gt;

&lt;p&gt;I cover the entire process step-by-step in my latest YouTube video. You can watch it here or read the summary below!&lt;/p&gt;

&lt;p&gt;

  &lt;iframe src="https://www.youtube.com/embed/09szNd_5ICQ"&gt;
  &lt;/iframe&gt;


&lt;/p&gt;




&lt;h2&gt;
  
  
  What is a TilingSprite?
&lt;/h2&gt;

&lt;p&gt;A &lt;code&gt;TilingSprite&lt;/code&gt; is a fast way to render a texture that repeats itself.&lt;/p&gt;

&lt;p&gt;Instead of stretching an image, it tiles the image to fill the defined area. The magic happens when we modify the &lt;strong&gt;UV coordinates&lt;/strong&gt; (offset) of the texture, allowing us to scroll the pattern within the sprite without moving the sprite itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Code
&lt;/h2&gt;

&lt;p&gt;Here is the quick recipe to get this working in your project.&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

const app = new PIXI.Application({
    width: 800,
    height: 600,
    backgroundColor: 0x1099bb
});

document.body.appendChild(app.view);

// Load your seamless background image
const texture = PIXI.Texture.from('assets/background.png');

// Create the TilingSprite
const background = new PIXI.TilingSprite(
    texture,
    app.screen.width,
    app.screen.height
);

// Add it to the stage
app.stage.addChild(background);

app.ticker.add((delta) =&amp;gt; {
    // Move the texture coordinates to the left
    background.tilePosition.x -= 2;

    // Optional: Move diagonally by changing Y as well
    // background.tilePosition.y += 1;
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>javascript</category>
      <category>gamedev</category>
      <category>pixijs</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
