-
Notifications
You must be signed in to change notification settings - Fork 0
/
Effects.as
106 lines (96 loc) · 2.54 KB
/
Effects.as
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
package {
import fl.transitions.Tween;
public class Effects {
private var fps:Number;
private var dur:Number;
private var scaleBegin:Number;
private var scaleFinish:Number;
public function Effects(){
// Empty Constructor
}
/*
* Sets tweening values from given input values.
*
* @param emotionFPS Array
* @param emotionDur Array
* @param emotionScaleBegin Array
* @param emotionScaleFinish Array
* @param intensity Number
*/
public function setParams(emotionFPS:Array, emotionDur:Array, emotionScaleBegin:Array, emotionScaleFinish:Array, intensity:Number):void
{
fps = this.getIntensity(emotionFPS,intensity);
dur = this.getIntensity(emotionDur,intensity);
scaleBegin = this.getIntensity(emotionScaleBegin,intensity);
scaleFinish = this.getIntensity(emotionScaleFinish,intensity);
}
/*
* Returns frames per second
*
* @return fps Number
*/
public function getFPS():Number {
return fps;
}
/*
* Returns duration of the caption
*
* @return dur Number
*/
public function getDuration():Number {
return dur;
}
/*
* Returns the initial scale value
*
* @return scaleBegin Number
*/
public function getScaleBegin():Number {
return scaleBegin;
}
/*
* Returns the scale value on finish
*
* @return scaleFinish Number
*/
public function getScaleFinish():Number {
return scaleFinish;
}
/*
* Retrieves duration of a caption
*
* @param begin Object
* @param finish Object
* @param speed Number
* @return duration Number
*/
public function duration (begin:Number, finish:Number, speed:Number):Number {
return Math.abs (finish - begin) * speed;
}
/*
* Resizes given input values.
*
* @param value Number
* @param scale Number
* @return scaledValue Number
*/
public function resize (value:Number, scale:Number):Number {
return (value * scale * 0.01);
}
/*
* Retrieves intensity of a given word
*
* @param intensity_array Object
* @param intensity Object
* @return intensity_array[index] Numbers
*/
public function getIntensity (intensity_array:Array, intensity:Number):Number {
var index:Number = intensity - 1;
if (index < 0)
return 0;
if (index > intensity_array.length)
index = intensity_array.length - 1;
return Number (intensity_array[index]);
}
}
}