Author Topic: How to make a bg filled with a tileable-moving texture?  (Read 17304 times)

Antares88

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 35
    • View Profile
How to make a bg filled with a tileable-moving texture?
« on: March 20, 2014, 07:23:31 AM »
Hi,
I'd like to make a background filled with a tileable texture, and make it move (I'm trying to achieve a moving dust effect).

I see that I can move any widget attaching a UITweenPosition script to it, but I have no idea how to automatically tile the texture so it doesn't leave empty space when it moves.

I'm not sure if my explanation is understandable, so I found a random website that has the moving background effect that I'm trying to achieve:
http://getcharacters.com/

Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to make a bg filled with a tileable-moving texture?
« Reply #1 on: March 20, 2014, 12:46:42 PM »
Watch the last video I posted. It explains exactly this.

Antares88

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 35
    • View Profile
Re: How to make a bg filled with a tileable-moving texture?
« Reply #2 on: March 20, 2014, 01:58:45 PM »
Hi,
if you mean the video "NGUI: Atlas and Font Modifiers", I watched it, but my problem is not to make the texture tileable and to avoid lines on the edges.

My problem is to make so that when I move the texture with TweenPosition new tiles fill the empty void that is created.

I made a sketch:

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to make a bg filled with a tileable-moving texture?
« Reply #3 on: March 21, 2014, 03:20:07 PM »
Tiled sprite doesn't fill the screen. It fills the widget's rectangle. When you move the widget, its rectangle is moved, so the filled area is moved as well.

You can change UVs of UITexture, but you can't change UVs of a tiled sprite. However if I understand what you're trying to do correctly, you can achieve what you want by simply making the widget wider, and when the tween reaches the end, restart it from the beginning. If you set it up correctly where the visible tiled area at the end matches the same texture at the beginning, there won't be any visible transition when it restarts the tween.