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 /*************************************************************************/
25 [self setWindowVisibility:ITTransientStatusWindowAppearingState];
26 [self performAppearFromProgress:0.0 effectTime:_effectTime];
29 - (void)performAppearFromProgress:(float)progress effectTime:(float)time
31 [_window setEffectProgress:progress];
32 _effectSpeed = (1.0 / (EFFECT_FPS * time));
34 if ( progress == 0.0 ) {
35 [_window setAlphaValue:0.0];
38 [_window orderFront:self];
39 _effectTimer = [NSTimer scheduledTimerWithTimeInterval:(1.0 / EFFECT_FPS)
41 selector:@selector(appearStep)
48 float interFade = 0.0;
49 [_window setEffectProgress:([_window effectProgress] + _effectSpeed)];
50 [_window setEffectProgress:( ([_window effectProgress] < 1.0) ? [_window effectProgress] : 1.0)];
51 interFade = (( sin(([_window effectProgress] * pi) - (pi / 2)) + 1 ) / 2);
52 [_window setAlphaValue:interFade];
54 if ( [_window effectProgress] >= 1.0 ) {
61 [_effectTimer invalidate];
63 [self setWindowVisibility:ITTransientStatusWindowVisibleState];
68 [self setWindowVisibility:ITTransientStatusWindowVanishingState];
70 [_effectTimer invalidate];
73 [self performVanishFromProgress:[_window effectProgress] effectTime:(_effectTime / 3.5)];
77 /*************************************************************************/
79 #pragma mark VANISH METHODS
80 /*************************************************************************/
84 [self setWindowVisibility:ITTransientStatusWindowVanishingState];
85 [self performVanishFromProgress:1.0 effectTime:_effectTime];
88 - (void)performVanishFromProgress:(float)progress effectTime:(float)time
90 [_window setEffectProgress:progress];
91 _effectSpeed = (1.0 / (EFFECT_FPS * time));
92 if ( progress == 1.0 ) {
93 [_window setAlphaValue:1.0];
96 [_window orderFront:self];
97 _effectTimer = [NSTimer scheduledTimerWithTimeInterval:(1.0 / EFFECT_FPS)
99 selector:@selector(vanishStep)
106 float interFade = 1.0;
107 [_window setEffectProgress:([_window effectProgress] - _effectSpeed)];
108 [_window setEffectProgress:( ([_window effectProgress] > 0.0) ? [_window effectProgress] : 0.0)];
109 interFade = (( sin(([_window effectProgress] * pi) - (pi / 2)) + 1 ) / 2);
110 [_window setAlphaValue:interFade];
112 if ( [_window effectProgress] <= 0.0 ) {
119 [_effectTimer invalidate];
121 [_window orderOut:self];
122 [_window setAlphaValue:1.0];
123 [self setWindowVisibility:ITTransientStatusWindowHiddenState];
128 [self setWindowVisibility:ITTransientStatusWindowVanishingState];
130 [_effectTimer invalidate];
133 [self performAppearFromProgress:[_window effectProgress] effectTime:(_effectTime / 3.5)];