forked from MattRix/UnityDecompiled
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAnimationCurve.cs
More file actions
129 lines (129 loc) · 3.39 KB
/
Copy pathAnimationCurve.cs
File metadata and controls
129 lines (129 loc) · 3.39 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace UnityEngine
{
[StructLayout(LayoutKind.Sequential)]
public sealed class AnimationCurve
{
internal IntPtr m_Ptr;
public Keyframe[] keys
{
get
{
return this.GetKeys();
}
set
{
this.SetKeys(value);
}
}
public Keyframe this[int index]
{
get
{
return this.GetKey_Internal(index);
}
}
public extern int length
{
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
get;
}
public extern WrapMode preWrapMode
{
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
get;
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
set;
}
public extern WrapMode postWrapMode
{
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
get;
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
set;
}
public AnimationCurve(params Keyframe[] keys)
{
this.Init(keys);
}
public AnimationCurve()
{
this.Init(null);
}
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private extern void Cleanup();
~AnimationCurve()
{
this.Cleanup();
}
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
public extern float Evaluate(float time);
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
public extern int AddKey(float time, float value);
public int AddKey(Keyframe key)
{
return this.AddKey_Internal(key);
}
private int AddKey_Internal(Keyframe key)
{
return AnimationCurve.INTERNAL_CALL_AddKey_Internal(this, ref key);
}
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern int INTERNAL_CALL_AddKey_Internal(AnimationCurve self, ref Keyframe key);
public int MoveKey(int index, Keyframe key)
{
return AnimationCurve.INTERNAL_CALL_MoveKey(this, index, ref key);
}
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern int INTERNAL_CALL_MoveKey(AnimationCurve self, int index, ref Keyframe key);
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
public extern void RemoveKey(int index);
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private extern void SetKeys(Keyframe[] keys);
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private extern Keyframe GetKey_Internal(int index);
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private extern Keyframe[] GetKeys();
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
public extern void SmoothTangents(int index, float weight);
public static AnimationCurve Linear(float timeStart, float valueStart, float timeEnd, float valueEnd)
{
float num = (valueEnd - valueStart) / (timeEnd - timeStart);
Keyframe[] keys = new Keyframe[]
{
new Keyframe(timeStart, valueStart, 0f, num),
new Keyframe(timeEnd, valueEnd, num, 0f)
};
return new AnimationCurve(keys);
}
public static AnimationCurve EaseInOut(float timeStart, float valueStart, float timeEnd, float valueEnd)
{
Keyframe[] keys = new Keyframe[]
{
new Keyframe(timeStart, valueStart, 0f, 0f),
new Keyframe(timeEnd, valueEnd, 0f, 0f)
};
return new AnimationCurve(keys);
}
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private extern void Init(Keyframe[] keys);
}
}