I was trying to create animation like skype bottom menu in iPhone. I tried many ways to solve it but wasn't able to configure the accurate solution.
I have tried,
(1)CGPathAddLineToPoint
(2)CGPathAddArc
(3)CGPathAddArcToPoint
(4)[UIView animateWithDuration:5000 delay:500 usingSpringWithDamping:0.5 initialSpringVelocity:0.5 options:option animations:^{
square.layer.cornerRadius = 25;
square.layer.masksToBounds = YES;
} completion:^(BOOL flag){
square.layer.cornerRadius = 0;
square.layer.masksToBounds = YES;
}];
and some UIKit Dynamic approaches too. Unfortunately none of them worked for me to get exact solution. Main problem that i was facing was that CornerRadius rounds whole view, where i need something Curved/Arc. Ark approach also didn't provides needed solution.
Animation in Skype works this way.
Working Demo
(1)Firstly user taps on bottom right,
(2)Then menu animates upward with a curved (curved outside) effect,
(3) After collision with top boundary (i guess it is using UIKit Dynamic and on top there is an invisible boundary), Menu shows a bounce back effect and again shows a curved effect but this time curve inside,
Kindly guide if i'm using right approach or what should i do?
Thanks
this is a nicely written tutorial on how to create such animation: http://holko.pl/2014/06/26/recreating-skypes-action-sheet-animation/
At the end of the tutorial, the author also includes the github address that hosts a reusable framework that you can directly use to create such effect.
Hope this helps.
Related
in my Application I like to use the frontcamera to display the user on the iPad/iPhone. This is already working. Now I like to have a simple transparent "HUD" floating over the cameradisplay. It's just a circle which should fill itself, so it is quite a simple animation. Since I am new to iOS Developing I am not sure which framework to use. Unfortunately there is no canvas like in android/html.
Can you please recommend a framework for doing the animations?
I would be very happy for a nice start into my next assignment!
Ios creating simple camera overlay in Xcode how?
The above question provides an answer which should help you add your own view over the top of the camera feed.
Make this an instance of a custom UIView subclass of your own which has the desired functionality.
UIKit has plenty of functionality for an animation as basic as the one you are describing. Look at setting the corner radius of your view.layer object and maybe animating a view from bottom to top using [UIView animateWithDuration:].
I'm fairly new to modern programming (the last serious experience I had was AMOS on my old Amiga!), but I've done my best to learn objective C with a view to developing an app (for iOS only at the moment). I've got a (hopefully very simple) question which I've done my best to research already without any joy.
I've got the bulk of my relatively basic app laid down already. From my home ViewController, I've got four options, all of which have colour-coded buttons, linked by segue to the content ViewControllers.
As a nice flourish, more than anything else, I'd like to make the whole screen flash briefly in the colour of the button pressed (this app is aimed at non-programmers, and a bit of theming will not only make things look good, but also hopefully aid orientation/ intuititivity.
So far I have tried:
adding a new ViewController with a screen blank except for the themed colour and an automated custom segue controlled by NSTimer. // This is sub-optimal as if the user wants to navigate back to the home page they have to jump through two pages rather than one, and if they're a bit slow then they may get stuck in a loop.
dicking around with NSTimer and self.window.backgroundColor/ setBackgroundColor. // both of these options end up with my app crashing - probably due to coding ineptitude!
Any ideas? For example, if my user clicked the 'Emergency Guidelines' UIButton, then I would have the screen flash red (the chosen theme colour for this section) for a barely perceptibly but subconsciously awesome period before seamlessly transitioning the app to the relevant page.
Sorry if it's a bit of a noobish question. I'm keen to hear any answers, even appropriately directed tough love.
I would suggest a different way. Don't use an extra viewController, instead add a colored UIView that covers the whole screen when the button was pressed. Animate a fade out, and once it's faded out completely remove that view and perform the push to the next viewController.
That's probably the easiest way, takes only this much code:
- (IBAction)demoButtonPressed:(UIButton *)sender {
UIView *flashView = [[UIView alloc] initWithFrame:self.view.bounds];
flashView.backgroundColor = [UIColor redColor];
[self.view addSubview:flashView];
[UIView animateWithDuration:0.3 delay:0.1 options:0 animations:^{
flashView.alpha = 0.0f;
} completion:^(BOOL finished) {
[flashView removeFromSuperview];
[self performSegueWithIdentifier:#"pushDemo1" sender:sender];
}];
}
Play around with duration and delay until you are satisfied.
have you looked into core animation? it would help if you therw up some code but i thing Apple's Core Animation tutorial is pretty straight forward with how you can trigger animation effects especially if a button is pressed like you mentioned for your color flash idea.
https://developer.apple.com/library/Mac/DOCUMENTATION/Cocoa/Conceptual/CoreAnimation_guide/Introduction/Introduction.html
you can also pull this up in X code which i suggest, or youtube some tutorials or github etc.
veritas
Anybody have any idea how this is done?
http://youtu.be/r_cII4_aq_A
In general, the idea is awesome, but I would like to know how to do each specific thing. In the video, the pages are being swiped too fast so you can't see, but as you transition from one page to the next, each pixel smoothly transitions to it's new color. Also, it's really cool how the icon gets smaller to a minimum size as you transition away from a screen.
Maybe there's some 3rd party library that provides a protocol and it's relatively easy to implement, but I can't find it. If there's not, I'm thinking it's just one view controller with many views side by side and as you drag your finger, it calculates where each view needs to be..and what color every pixel needs to be.
I imagine you already have it by now. But in case you still have any doubts, I made gist that does the animation: https://gist.github.com/mnmaraes/9536364
Anyways, have fun.
It's a fade animation, so:
[UIView animateWithDuration:0.5
delay:0.0
options:UIViewAnimationOptionTransitionCrossDissolve
animations:^{
_backgroundImageView.image = nextImage;
} completion:nil];
should do the trick for the background part.
For the foreground/icon part you can animate the transform to scale and translate the views as they slide in and out.
I have gone through various posts for animating UIImageview like
books pages but didn't find anything useful.
Actually I want to have animation on UIImageView to have the same effect as we have while
turning books's pages. I have used the following code to turn the UIImageview:
[UIView transitionWithView:self.greetingImgView
duration:1.0f
options:UIViewAnimationOptionTransitionCurlUp
But I am not able to get the desired page curl animation as we have while turning books pages.
I want a kind of animation where the user can have a feel of book page animation while viewing animation.
Please help me; I have researched a lot.
if you want a book like interface for your app, why not using the UIPageViewController. This class provides all you need and you can set the pageing animation as you want.
There a lot of similar questions with answers. For example:
link
but almost all of them are unsuitable because I also want to perform something like this:
button1.frame = button2.frame;
button2.hidden = YES;
So if I use an example with beginAnimations: then I can see how button1 changes its frame (it moves while app perfoms a transition animation).
How to solve this issue? First of all should I set a button frame in another way or should I find another code for transition?
EDITED
Additionally I have found out that not all ways allow to show fade animation I need so I have edited my question a little.
link
The best solution from it is animating way which works for my case.
The most strange thing is to disable view controller's own animation instead of its changing.