objective c - How can I move a UIView to an end location but make it slow down as it approaches it? -
I try to move a box from point A = (0, 0) to B = (0, 1000) But I want to be slow because it reaches point B. I tried UIViewAnimationOptionCurveEaseOut but it seems that continuous velocity moves. Any ideas? The easiest way is to get animation in different stages, with different speeds, such as: It should get a smooth animation to play with a little bit.
UIView * box = [[UIView alloc] in this]; Box.frame = CGRectMake (0, 0, 500, 500); Box.backgroundColor = [UIColor redColor]; [Self.view addSubview: box]; // Animation [UIView animateWithDuration: 0.3 Delay: 0.0 Option: UIViewAnimationOptionCurveEaseOut Animation: ^ {box.frame = CGRectMake (0, 1000, box.frame.size.width, box.frame.size.height); } Completion: zero];
// aviation step 1 [UIView animateWithDuration: 0.1 / / First half is faster delay: 0.0 Option: UIViewAnimationOptionCurveEaseIn Animation: ^ {box.frame = CGRectMake (0, 500, box .frame.size .width, box.frame.size.height); } Closing: ^ (BOOL Finish) {// Animation Phase 2 [UIView animateWithDuration: 0.2 / sec / second half slow delay: 0.0 Option: UIViewAnimationOptionCurveEaseOut Animation: ^ {box.frame = CGRectMake (0, 1000, box.frame.size. Width, box.frame.height.height); } Completion: zero]; }];
Comments
Post a Comment