IOS 3D Transform like Clear app - ios

so what I want is to do the same thing Clear (http://www.realmacsoftware.com/clear/) does.
If I pan up or down it makes a new rectangle appear with a 3D visual effect.
I did manage to do this by using a translation and rotation transform along with changing the m34 property.
The problem is that since I move 2 views (like Clear moving the rectangle that is showing on screen, and the rectangle appearing with the 3D visual effect), when the user stop touching the screen I use a
[UIView animateWithDuration:0.5
delay:0
options: UIViewAnimationCurveEaseOut
animations:^{
...
}
completion:nil];
to restore the views to a consistent state, either showing the new rectangle, or not (sliding it down), I can see the black background between the 2 views, meaning that the 2 rectangles are not being redrawn at same time.
How do I solve that?

It's difficult to answer your specific question without more details, but you can look at https://github.com/mpospese/MPFoldTransition for inspiration.
Mark Pospesel developed this wrapper to perform these kinds of folding transforms, and describes the process behind them in detail in his "Anatomy of a folding animation" blog post.

Related

Watchkit animation implementations: clock face, animated charts, circular progress bar

I've seen some very basic demos of potential watchkit apps, and some appear to implement animations. Examples might be:
A clock face with a moving second hand or even minute hand.
A bar chart with bars that animate in, or who shape changes with new real-time data.
A circular progress bar who's bar animates from zero to the current value.
The only way I've seen so far to do animations is by a sequence of images over a duration:
[imageView startAnimatingWithImagesInRange:NSMakeRange(0, 60) duration:1.0 repeatCount:0];
How would these previous animation examples generally be implemented? I can't imagine they are all done with image sequences. I don't think one can even layer images, and coordinating placement would be a nightmare.
They are all done with sequences of images. Here is some code for how I animate movement on a map. Is it possible to position views on top of each other
Edit
You may also find these frameworks helpful.
https://github.com/frosty/Flipbook
https://github.com/radianttap/WatchRingGenerator
2nd Edit
Here is another great article on adding animation into your Watch App. http://david-smith.org/blog/2015/03/04/ailw-adding-bits-of-liveliness/

How can I animate in the entrance of a CAEmitterCell?

Currently my particles appear on screen abruptly in their full shape and form. What I want is for the cells to either start at 0.0 opacity and animate up to full opacity, or start at 0.0 scale and animate up to 1.0 scale. I can't find anything online on how to do this.
You can animate the various properties of a CAEmitterCell, there is a good example at animating the CAEmitterCell Color property that should give you a good idea of what you should do to get the effect you want.
There are lots of great resources on CAEmitters, one good one is Tutorial: Particle Systems in Core Animation with CAEmitterLayer and another is Apple's Fireworks Sample Code

Flip Animation Using Core Animation Showing Reversed Contents

Here is the result that I get:
If I set the doubleSided property of layer 4 as No, the whole layer disappears. I know that already. But then, how can I show yet with correct content orientation?
Do the animation in two parts. At the halfway point, when the layer is side-on to the camera so you can’t see it, flip the layer the other way around and move the anchor point to the other side, and swap out the contents of the layer if you need to.
Unfortunately, I don’t have any sample code, because the last time I did this was on iOS 4, and the pile of hacks view-based animations that I was using don’t appear to work on layers any more. You could post your own code and accept your own answer if you want.

How can I reproduce a "box" transition animation in iOS?

I want to build an animated transition between two view controllers in iOS, resembling the "Box" transition in PowerPoint or the "Reflection" transition in Keynote.
You can see it here, at 2:10:
http://youtu.be/1fLQg5hFQQg?t=2m10s
What's the best way to do this?
Thanks!
That would be a complex animation to recreate. You'd need to use a CAAnimationGroup that grouped several different animations running at once. You'd want to animate a rotation around the y axis with the center of rotation lifted off the screen, on both the view controller that is animating away and the view that your are animating into place.
You would have to tweak the transform to make it draw with perspective (you add a small value to the .m34 record in the transform). That's because CA animations are orthographic by default (they don't show perspective.)
The reflections could be created using a special subclass of CALayer that lets you create duplicates of a layer. I'm blanking on the name of that layer subclass at the moment. You'd set up 1 duplicate with a scale of -1 on the y axis to flip it upside down, and a darkening effect. I've never done it myself, but I've seen several examples in books and online.

UIImage - maze type 2d grid - how to address each position programmatically?

What I am doing is very simple. I have a simple 2d Maze game - think puzzle game that I am working on. I am not needing to use OpenGL for this. I am wanting to use UIImage's. Imagine I have a wall tile (64x64 pixels) and I want to write code to duplicated this wall tile along the top and edges of the screen area- to in effect build a wall around the edges of the screen. play will take place inside this area. How would I go about doing this in code. From what I gather I would need to create a new UIImage each time I wanted to place a tile and move coordinates. Later on though, say I wanted to take the second tile along and replace it with say a bomb. Or maybe the 4th one along? My question really is.. in code how would I address this 2nd or 4th tile (when the number 2 or 4 could be random) and change its graphic? I hope I have explained this enough.. Also If I have updated some tiles, is there a call I should be making to hurry up the screen refresh so to speak?
As I understand, you can just create some UIImageView objects. Each one for one of your tiles. And then you'll be able to change frames with animation. For example. You have image you want to replace. I have no mac right now nearby, so, my code may not wark after just copy and paste)
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5f];
[imageView setFrame:newFrame];
[UIView commitAnimations];
This code will move your image with animation.

Resources