1 #import "ITDissolveWindowEffect.h"
2 #import "ITTransientStatusWindow.h"
5 @interface ITDissolveWindowEffect (Private)
6 - (void)performAppearFromProgress:(float)progress effectTime:(float)time;
9 - (void)performVanishFromProgress:(float)progress effectTime:(float)time;
15 @implementation ITDissolveWindowEffect
18 /*************************************************************************/
20 #pragma mark APPEAR METHODS
21 /*************************************************************************/
27 [self setWindowVisibility:ITWindowAppearingState];
28 [self performAppearFromProgress:0.0 effectTime:_effectTime];
31 - (void)performAppearFromProgress:(float)progress effectTime:(float)time
33 [_window setEffectProgress:progress];
34 _effectSpeed = (1.0 / (EFFECT_FPS * time));
36 if ( progress == 0.0 ) {
37 [_window setAlphaValue:0.0];
40 [_window orderFront:self];
41 _effectTimer = [NSTimer scheduledTimerWithTimeInterval:(1.0 / EFFECT_FPS)
43 selector:@selector(appearStep)
50 float interFade = 0.0;
51 [_window setEffectProgress:([_window effectProgress] + _effectSpeed)];
52 [_window setEffectProgress:( ([_window effectProgress] < 1.0) ? [_window effectProgress] : 1.0)];
53 interFade = (( sin(([_window effectProgress] * pi) - (pi / 2)) + 1 ) / 2);
54 [_window setAlphaValue:interFade];
56 if ( [_window effectProgress] >= 1.0 ) {
63 [_effectTimer invalidate];
65 [self setWindowVisibility:ITWindowVisibleState];
69 if ( __shouldReleaseWhenIdle ) {
76 [self setWindowVisibility:ITWindowVanishingState];
78 [_effectTimer invalidate];
81 [self performVanishFromProgress:[_window effectProgress] effectTime:(_effectTime / 3.5)];
85 /*************************************************************************/
87 #pragma mark VANISH METHODS
88 /*************************************************************************/
94 [self setWindowVisibility:ITWindowVanishingState];
95 [self performVanishFromProgress:1.0 effectTime:_effectTime];
98 - (void)performVanishFromProgress:(float)progress effectTime:(float)time
100 [_window setEffectProgress:progress];
101 _effectSpeed = (1.0 / (EFFECT_FPS * time));
102 if ( progress == 1.0 ) {
103 [_window setAlphaValue:1.0];
106 [_window orderFront:self];
107 _effectTimer = [NSTimer scheduledTimerWithTimeInterval:(1.0 / EFFECT_FPS)
109 selector:@selector(vanishStep)
116 float interFade = 1.0;
117 [_window setEffectProgress:([_window effectProgress] - _effectSpeed)];
118 [_window setEffectProgress:( ([_window effectProgress] > 0.0) ? [_window effectProgress] : 0.0)];
119 interFade = (( sin(([_window effectProgress] * pi) - (pi / 2)) + 1 ) / 2);
120 [_window setAlphaValue:interFade];
122 if ( [_window effectProgress] <= 0.0 ) {
129 [_effectTimer invalidate];
131 [_window orderOut:self];
132 [_window setAlphaValue:1.0];
133 [self setWindowVisibility:ITWindowHiddenState];
137 if ( __shouldReleaseWhenIdle ) {
144 [self setWindowVisibility:ITWindowVanishingState];
146 [_effectTimer invalidate];
149 [self performAppearFromProgress:[_window effectProgress] effectTime:(_effectTime / 3.5)];