+- (void)pivotEffect
+{
+ if ( _visibilityState == ITTransientStatusWindowEnteringState ) {
+ [self setPivot:315.0];
+ _effectProgress = 0.0;
+ [self setAlphaValue:0.0];
+ [super orderFront:self];
+ _effectTimer = [NSTimer scheduledTimerWithTimeInterval:(1.0 / EFFECT_FPS)
+ target:self
+ selector:@selector(pivotStep)
+ userInfo:nil
+ repeats:YES];
+ } else {
+ [super orderOut:self];
+ _visibilityState = ITTransientStatusWindowHiddenState;
+ }
+}
+
+- (void)pivotStep
+{
+ if ( _visibilityState == ITTransientStatusWindowEnteringState ) {
+ float interPivot = 0.0;
+ _effectProgress += (1.0 / (EFFECT_FPS * _effectTime));
+ _effectProgress = (_effectProgress < 1.0 ? _effectProgress : 1.0);
+ interPivot = (( sin((_effectProgress * pi) - (pi / 2)) + 1 ) / 2);
+ [self setPivot:((interPivot * 45) + 315)];
+ [self setAlphaValue:interPivot];
+ if ( _effectProgress >= 1.0 ) {
+ [self pivotFinish];
+ }
+ } else {
+ //backwards
+ }
+}
+
+- (void)pivotFinish
+{
+ if ( _visibilityState == ITTransientStatusWindowEnteringState ) {
+ [_effectTimer invalidate];
+ _effectTimer = nil;
+ _effectProgress = 0.0;
+ _visibilityState = ITTransientStatusWindowVisibleState;
+ } else {
+ //backwards
+ }
+}
+
+
+- (void)setPivot:(float)angle
+{
+ float degAngle = (angle * (pi / 180));
+ CGAffineTransform transform = CGAffineTransformMakeRotation(degAngle);
+ transform.tx = -32.0;
+ transform.ty = [self frame].size.height + 32.0;
+ CGSSetWindowTransform([NSApp contextID],
+ (CGSWindowID)[self windowNumber],
+ CGAffineTransformTranslate(transform,
+ (([self frame].origin.x - 32.0) * -1),
+ (([[self screen] frame].size.height - ([self frame].origin.y) + 32.0) * -1) ));
+}