Welcome,
Guest
. Please
login
or
register
.
April 29, 2026, 01:40:02 PM
Home
Help
Search
Login
Register
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
Ablility to use Unity Animation Timeline to animate AnchorPoints
« previous
next »
Print
Pages: [
1
]
Author
Topic: Ablility to use Unity Animation Timeline to animate AnchorPoints (Read 3395 times)
Raj
Newbie
Thank You
-Given: 0
-Receive: 0
Posts: 2
Ablility to use Unity Animation Timeline to animate AnchorPoints
«
on:
March 31, 2014, 03:18:23 PM »
We would like to be able to animate AnchorPoints within the Unity Animation Timeline as this is a preferable way for our artists to animate objects rather than using the Tween objects.
Logged
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: Ablility to use Unity Animation Timeline to animate AnchorPoints
«
Reply #1 on:
April 01, 2014, 07:41:04 AM »
You can certainly do that, but you will need an intermediate script like so:
using
UnityEngine
;
[
ExecuteInEditMode
]
[
RequireComponent
(
typeof
(
UIRect
)
)
]
public
class
AnimatedAnchor
:
MonoBehaviour
{
public
float
left
=
0f
;
public
float
right
=
0f
;
public
float
top
=
0f
;
public
float
bottom
=
0f
;
UIRect mRect
;
void
Start
(
)
{
mRect
=
GetComponent
<
UIRect
>
(
)
;
left
=
mRect
.
leftAnchor
.
absolute
;
right
=
mRect
.
rightAnchor
.
absolute
;
top
=
mRect
.
topAnchor
.
absolute
;
bottom
=
mRect
.
bottomAnchor
.
absolute
;
}
void
Update
(
)
{
if
(
mRect
.
leftAnchor
.
absolute
!=
left
)
mRect
.
leftAnchor
.
absolute
=
left
;
if
(
mRect
.
rightAnchor
.
absolute
!=
right
)
mRect
.
rightAnchor
.
absolute
=
right
;
if
(
mRect
.
topAnchor
.
absolute
!=
top
)
mRect
.
topAnchor
.
absolute
=
top
;
if
(
mRect
.
bottomAnchor
.
absolute
!=
bottom
)
mRect
.
bottomAnchor
.
absolute
=
bottom
;
}
}
Logged
Raj
Newbie
Thank You
-Given: 0
-Receive: 0
Posts: 2
Re: Ablility to use Unity Animation Timeline to animate AnchorPoints
«
Reply #2 on:
April 01, 2014, 08:05:46 AM »
Thanks, one of our engineers had though about this approach, but we thought it might be more useful on the Widget.
We'll give this a go it should be fine.
Cheers
Logged
Print
Pages: [
1
]
« previous
next »
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
Ablility to use Unity Animation Timeline to animate AnchorPoints