ICanHazFlush

Discussion in 'iOS Development' started by SkylarEC, May 5, 2009.

  1. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    As a joke on irc, I created a new animation transition. Enjoy.


    Just plop this into your app. Replace yourViewtoFlush with the view that you want flushed. Clearly, change the other variables so that the animation looks good to you.

    [OBJC]#define degreesToRadians(x) (M_PI * x / 180.0)

    - (void)flushView

    Please Register or Log in to view images

    NSString*)animationID finished

    Please Register or Log in to view images

    BOOL)finished context

    Please Register or Log in to view images

    void *)context {
    if (yourViewtoFlush.frame.size.width < 10) {
    [yourViewtoFlush removeFromSuperview];
    return;
    }
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationBeginsFromCurrentState:YES];
    [UIView setAnimationCurve:UIViewAnimationCurveLinear];
    [UIView setAnimationDuration:0.15];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDidStopSelector

    Please Register or Log in to view images

    selector(flushView:finished:context

    Please Register or Log in to view images

    ];

    yourViewtoFlush.transform = CGAffineTransformConcat(CGAffineTransformRotate(yourViewtoFlush.transform, degreesToRadians(65)), CGAffineTransformMakeScale(0.8, 0.8));
    yourViewtoFlush.alpha -= 0.15;

    [UIView commitAnimations];
    }[/OBJC]


    To start the animation, call the following. It will end by itself.
    [OBJC][self flushView:nil finished:YES context:nil];[/OBJC]
  2. Chicken

    Chicken Retired Moderator

    Joined:
    Feb 17, 2008
    Messages:
    2,494
    Likes Received:
    7
    Device:
    iPhone 5S
    I would just like to know which IRC channel?
  3. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
  4. Just_For_Now

    Just_For_Now Active Member

    Joined:
    Mar 21, 2009
    Messages:
    1,898
    Likes Received:
    1
    Device:
    4G iPod touch
    Whoa that is so cool. Thanks and would you also post the other animation when you press the info button? thanks.
  5. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    There's nothing special about the other transition. It's just the rippleEffect CATransition. USe it like you would any other CATransition, only instead of using kCAAnimationPushFromRight (or whatever you use), use @"rippleEffect."
  6. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129

Share This Page