Skip to content

Instantly share code, notes, and snippets.

@primalmotion
Forked from joehoyle/gist:622600
Created October 12, 2010 17:59
Show Gist options
  • Save primalmotion/622618 to your computer and use it in GitHub Desktop.
Save primalmotion/622618 to your computer and use it in GitHub Desktop.
- (void)showActiveView
{
var centerX = [[[CPApp mainWindow] contentView] frame].size.width / 2,
centerY = [[[CPApp mainWindow] contentView] frame].size.height / 2,
frameTo = [activeView frame],
frameFrom;
frameTo.origin.x = centerX - (frameTo.size.width / 2);
frameTo.origin.y = centerY - (frameTo.size.height / 2);
frameFrom = CGRectMakeCopy(frameTo);
if (!isShowingView)
{
frameFrom.size.width = (frameFrom.size.width / 1.1);
frameFrom.size.height = (frameFrom.size.height / 1.1);
}
else
{
frameFrom.origin.x = frameFrom.origin.x + 20;
frameFrom.origin.y = frameFrom.origin.y + 20;
}
[activeView setBackgroundColor:[CPColor whiteColor]];
[activeView setAlphaValue:0];
//show the view
[activeView setFrame:frameFrom];
[activeView makeCenterOfSuperview];
if (!isShowingView)
{
[[[CPApp mainWindow] contentView] addSubview:activeView];
[[[CPApp mainWindow] contentView] addSubview:overlayView];
}
else
[[[CPApp mainWindow] contentView] addSubview:activeView];
if (!isShowingView)
[overlayView setAlphaValue:0.7 animate:YES duration:.4];
[activeView setFrame:frameTo animate:YES duration:.15];
[activeView setAlphaValue:1 animate:YES duration:.2];
isShowingView = YES;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment