Nextrek
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
//----------------------------------------------
// NGUI: Next-Gen UI kit
// Copyright © 2011-2013 Tasharen Entertainment
//----------------------------------------------
using UnityEngine;
/// <summary>
/// Tween the camera's orthographic size.
/// </summary>
[RequireComponent(typeof(Camera))]
[AddComponentMenu("NGUI/Tween/Tween Orthographic Size")]
public class TweenOrthoSize : UITweener
{
public float from = 1f;
public float to = 1f;
Camera mCam;
/// <summary>
/// Camera that's being tweened.
/// </summary>
public Camera cachedCamera { get { if (mCam == null) mCam = camera; return mCam; } }
/// <summary>
/// Current field of view value.
/// </summary>
public float orthoSize
{
get { return cachedCamera.orthographicSize; }
set { cachedCamera.orthographicSize = value; }
}
/// <summary>
/// Perform the tween.
/// </summary>
protected override void OnUpdate (float factor, bool isFinished)
{
cachedCamera.orthographicSize = from * (1f - factor) + to * factor;
}
/// <summary>
/// Start the tweening operation.
/// </summary>
static public TweenOrthoSize Begin (GameObject go, float duration, float to)
{
TweenOrthoSize comp = UITweener.Begin<TweenOrthoSize>(go, duration);
comp.from = comp.orthoSize;
comp.to = to;
if (duration <= 0f)
{
comp.Sample(1f, true);
comp.enabled = false;
}
return comp;
}
}
|
Revision |
Author |
Commited |
Message |
83
|
FMMortaroli
|
Tue 13 May, 2014 11:32:51 +0000 |
|