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.

  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];   

Any ideas?

The easiest way is to get animation in different stages, with different speeds, such as:

  // 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]; }];   

It should get a smooth animation to play with a little bit.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -