1 #import "ITPivotWindowEffect.h"
2 #import "ITCoreGraphicsHacks.h"
4 @implementation ITPivotWindowEffect
9 NSLog(@"ITPivotWindowEffect does not implement performAppear.");
14 NSLog(@"ITPivotWindowEffect does not implement performVanish.");
20 [self setPivot:315.0];
21 _effectProgress = 0.0;
22 [_window setAlphaValue:0.0];
23 [_window orderFront:self];
24 _effectTimer = [NSTimer scheduledTimerWithTimeInterval:(1.0 / EFFECT_FPS)
26 selector:@selector(pivotStep)
30 [_window orderOut:self];
37 float interPivot = 0.0;
38 _effectProgress += (1.0 / (EFFECT_FPS * _effectTime));
39 _effectProgress = (_effectProgress < 1.0 ? _effectProgress : 1.0);
40 interPivot = (( sin((_effectProgress * pi) - (pi / 2)) + 1 ) / 2);
41 [self setPivot:((interPivot * 45) + 315)];
42 [_window setAlphaValue:interPivot];
43 if ( _effectProgress >= 1.0 ) {
54 [_effectTimer invalidate];
56 _effectProgress = 0.0;
63 - (void)setPivot:(float)angle
65 float degAngle = (angle * (pi / 180));
66 CGAffineTransform transform = CGAffineTransformMakeRotation(degAngle);
70 transform.ty = [_window frame].size.height + 32.0;
72 CGSSetWindowTransform([NSApp contextID],
73 (CGSWindowID)[_window windowNumber],
74 CGAffineTransformTranslate(transform,
75 (([_window frame].origin.x - 32.0) * -1),
76 (([[_window screen] frame].size.height - ([_window frame].origin.y) + 32.0) * -1) ));