Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8169365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:49:29+00:00 2026-06-06T20:49:29+00:00

I’m attempting to implement window-flipping identical to that in iWork – https://dl.dropbox.com/u/2338382/Window%20Flipping.mov However, I

  • 0

I’m attempting to implement window-flipping identical to that in iWork –

https://dl.dropbox.com/u/2338382/Window%20Flipping.mov

However, I can’t quite seem to find a straightforward way of doing this. Some tutorials suggest sticking snapshot-images of both sides of the window in a bigger, transparent window and animate those. This might work, but seems a bit hacky, and the sample code is always bloated. Some tutorials suggest using private APIs, and since this app may be MAS-bound, I’d like to avoid that.

How should I go about implementing this? Does anyone have any hints?

NSWindow+Flipping

I’ve rewritten the ancient code linked below into NSWindow+Flipping. You can grab these source files from my misc. Cocoa collection on GitHub, PCSnippets.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T20:49:32+00:00Added an answer on June 6, 2026 at 8:49 pm

    You can achieve this using CoreGraphics framework. Take a look at this:

    - (void) flipWithDuration: (float) duration forwards: (BOOL) forwards
    {
      CGSTransitionSpec spec;
      CGSTransitionHandle transitionHandle;
      CGSConnection cid = CGSDefaultConnection;
    
      spec.type = CGSFlip;
      spec.option = 0x80 | (forwards ? 2 : 1);
      spec.wid = [self windowNumber];
      spec.backColor = nil;
    
      transitionHandle = -1;
      CGSNewTransition (cid, &spec, &transitionHandle);
      CGSInvokeTransition (cid, transitionHandle, duration);
      [[NSRunLoop currentRunLoop] runUntilDate: 
            [NSDate dateWithTimeIntervalSinceNow: duration]];
      CGSReleaseTransition (cid, transitionHandle);
    }
    

    You can download sample project: here. More info here.

    UPDATE:

    Take a look at this project. It’s actually what You need.

    About this project:

    This category on NSWindow allows you to switch one window for
    another, using the “flip” animation popularized by Dashboard widgets.
    This was a nice excuse to learn something about CoreImage and how to
    use it in Cocoa. The demo app shows how to use it. Scroll to the end
    to see what’s new in this version!

    Basically, all you need to do is something like:

    [someWindow flipToShowWindow:someOtherWindow forward:YES];
    

    However, this code makes some assumptions: — someWindow (the initial
    window) is already visible on-screen. — someOtherWindow (the final
    window) is not already visible on-screen. — Both windows can be
    resized to the same size, and aren’t too large or complicated — the
    latter conditions being less important the faster your CPU/video card
    is. — The windows won’t go away while the animation is running. — The
    user won’t try to click on the animated window or do something while
    the animation is running.

    The implementation is quite straightforward. I move the final to the
    same position and size as the initial window. I then position a larger
    transparent window so it covers that frame. I render both window
    contents into CIImages, hide both windows, and start the animation.
    Each frame of the animation renders a perspective-distorted image into
    the transparent window. When the animation is done, I show the final
    window. Some tricks are used to make this faster; the flipping window
    is setup only once; the final window is hidden by setting its alpha to
    0.0, not by ordering it out and later ordering it back in again, for instance.

    The main bottleneck is the CoreImage filter, and the first frame
    always takes much longer to render — 4 or 6 times what it takes for
    the remaining frames. I suppose this time is spent with setup and
    downloading to the video card. So I calculate the time this takes and
    draw a second frame at a stage where the rotation begins to show. The
    animation begins at this point, but, if those first two frames took
    too long, I stretch the duration to make sure that at least 5 more
    frames will get rendered. This will happen with slow hardware or large
    windows. At the end, I don’t render the last frame at all and swap the
    final window in instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I need a function that will clean a strings' special characters. I do NOT
I'm trying to create an if statement in PHP that prevents a single post

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.