Welcome,
Guest
. Please
login
or
register
.
February 07, 2025, 06:02:51 AM
Home
Help
Search
Login
Register
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
Scrolling UV Animation
« previous
next »
Print
Pages: [
1
]
Author
Topic: Scrolling UV Animation (Read 5665 times)
Marckeeling
Newbie
Thank You
-Given: 0
-Receive: 0
Posts: 8
Scrolling UV Animation
«
on:
February 21, 2014, 04:38:59 PM »
Hi
I was wondering if there was now a simple way to achieve this effect?
http://www.youtube.com/watch?v=2CBTFqWioD4
This effect features a great deal in my design and I'm struggling to find a way whilst also using sprite sheets.
Any help would be really appreciated.
Thanks
Logged
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: Scrolling UV Animation
«
Reply #1 on:
February 21, 2014, 04:48:49 PM »
Easiest way to achieve that would be to overlay a UITexture on top of your button's background, and scroll it by adjusting its UV rect.
Logged
BeShifty
Jr. Member
Thank You
-Given: 5
-Receive: 7
Posts: 52
Re: Scrolling UV Animation
«
Reply #2 on:
February 21, 2014, 04:56:57 PM »
Hey that was my video. Since implementing the script, NGUI has changed significantly. The script I had written extends UITiledSprite, and piggybacks on its Vertex Generation function OnFill(). It basically just let the UITiledSprite generate all the vertices, then applied a UV offset before returning them. Here's those old scripts:
https://dl.dropbox.com/u/39656041/ScrollingTextures-NGUI.zip
Logged
Marckeeling
Newbie
Thank You
-Given: 0
-Receive: 0
Posts: 8
Re: Scrolling UV Animation
«
Reply #3 on:
February 21, 2014, 05:05:54 PM »
Yeah i tried the scripts just a second ago, and with not much luck. The console wasn't too happy with me xD
It's all way over my head unfortunately.
Logged
Marckeeling
Newbie
Thank You
-Given: 0
-Receive: 0
Posts: 8
Re: Scrolling UV Animation
«
Reply #4 on:
February 21, 2014, 05:06:45 PM »
Btw I was writing a post to say thank you for the help, but you guys are too quick for me
Logged
Marckeeling
Newbie
Thank You
-Given: 0
-Receive: 0
Posts: 8
Re: Scrolling UV Animation
«
Reply #5 on:
February 22, 2014, 11:13:51 AM »
Been trying to get this feature to work all night xD could I possibly get some help from someone who understands this? Im worried its no longer possible and am considering frame animation to compensate. This will be far too slow though :S
Logged
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: Scrolling UV Animation
«
Reply #6 on:
February 22, 2014, 11:23:27 AM »
As I said... create a UITexture (ALT+SHIFT+T), assign your striped texture to it or whatever you want to scroll, and in your script modify the UITexture's UV rect.
Logged
Marckeeling
Newbie
Thank You
-Given: 0
-Receive: 0
Posts: 8
Re: Scrolling UV Animation
«
Reply #7 on:
February 22, 2014, 12:00:02 PM »
OK, thank you for the support, It was the script writing part that i needed to avoid << smelly artist doesn't understand the use of public and private stuff...
I'll have to get help after the weekend then. Thanks anyway
Logged
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: Scrolling UV Animation
«
Reply #8 on:
February 23, 2014, 10:48:53 AM »
using
UnityEngine
;
public
class
UVAnimation
:
MonoBehaviour
{
public
Vector2 animRate
=
new
Vector2
(
1f, 0f
)
;
void
Update
(
)
{
UITexture tex
=
GetComponent
<
UITexture
>
(
)
;
if
(
tex
!=
null
)
{
Rect rect
=
tex
.
uvRect
;
rect
.
x
+=
animRate
.
x
*
Time
.
deltaTime
;
rect
.
y
+=
animRate
.
y
*
Time
.
deltaTime
;
tex
.
uvRect
=
rect
;
}
}
}
Logged
Marckeeling
Newbie
Thank You
-Given: 0
-Receive: 0
Posts: 8
Re: Scrolling UV Animation
«
Reply #9 on:
February 25, 2014, 04:24:28 AM »
Thank you so much dude, christ this is the best support ive ever experienced. Congratz
Logged
Print
Pages: [
1
]
« previous
next »
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
Scrolling UV Animation