objective c genie effect

Discussion in 'iOS Programming' started by erdinc27, Jan 27, 2017.

  1. erdinc27 macrumors regular

    Joined:
    Jul 20, 2011
    #1
    I want to create a genie effect for a view. Actually not exactly genie effect like in MacOS i want something similar. I want a view to transform and change the position at the same time. How i would do such effect ?

    I did something like that but it doesn' t give the intended effect ?

    Code:
    - (void) animateTheView:(UIView *) paramView {
        
        CATransition *transition = [CATransition animation];
        transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
        transition.duration = 1.0f;
        transition.type = @"suckEffect";
        transition.subtype = @"fromBottom";
        [UIView setAnimationTransition:(int)transition forView:paramView cache:NO];
        [UIView setAnimationDuration:1.0f];
        [[paramView layer] addAnimation:transition forKey:nil];
        [UIView commitAnimations];
    }
     
  2. dantastic macrumors 6502a

    dantastic

    Joined:
    Jan 21, 2011
    #2
    If you are looking to create something similar to a genie effect you will have to do 2 things at once.
    1) Animate the position along a UIBezerPath
    2) Animate the transform of the view.

    With these things it's a case of trial and error until you are happy with the effect. Depending on the desired end result you may have to perform several animation steps in order to achieve the right effect.
     

Share This Page