How would you go about creating a timeline animation for an iPhone or iPad application? I'm looking for something like a timeline animation in Flash. I don't need a technical explanation on how to program it, though.
So here are some general questions:
- I read something about UIView for PNG sequences, but aren't these kind of animations resource intensive? And what about filesize? PNG can't be compressed like jpeg.
- What about vector-like animations? These would save a lot of kb's.
- Are there animation frameworks like TweenLite/TweenMax/Tweener/... (some well known frameworks for animations in ActionScript) ?
- Any good references on how to make animations (like Text animations, ...)
Thanks in advance.
Bart
Apple pretty much spells it out in Getting Started with Graphics and animation.
In general just stick with the highest possible API, and test to see if it's going to meet your needs or not. Moving around a UIView or UILabel (text) as in a Timeline Animation not only takes just a couple of lines of code but it will probably perform just fine.
This only just came out, but have you heard of Hirameki?
It's a flash animation parser that lets you drop SWF animations directly into Xcode projects for iPhone. A demonstration and beta sign up is here http://www.flash-on-iphone.com
Related
I need to implement on-screen drawing feature within one of my apps. I would imagine it would be an on-screen transparent overlay. I'm looking to be able to trace the finger path and leave a line, select colors and have erase/undo feature.
I did some research of what's currently on the app store, and a lot of those apps look similar and use similar brushes.
Something tells me that they look too much alike for this to be a coincidence. Does apple provide any built-in finger painting canvas, or are there some widely-known open source projects for on-screen drawing?
Thank you!
I ran into the same thing while looking for examples when I got started with drawing, so I released my efforts as a sample project called SimpleDrawing. I tried to keep things basic while supporting most/all of the standard drawing tools and operations.
There is the GLPaint project, which you can get here.
Other than that, you could use CoreGraphics & -touchesBegan:withEvent: if you wanted.
I'm working on an iPhone game that involves only two dimensional, translation-based animation of just one object. This object is subclassed from UIView and drawn with Quartz-2D. The translation is currently put into effect by an NSTimer that ticks each frame and tells the UIView to change its location.
However, there is some fairly complex math that goes behind determining where the UIView should move during the next frame. Testing the game on the iOS simulator works fine, but when testing on an iPhone it definitely seems to be skipping frames.
My question is this: is my method of translating the view frame by frame simply a bad method? I know OpenGL is more typically used for games, but it seems a shame to set up OpenGL for such a simple animation. Nonetheless, is it worth the hassle?
It's hard to say without knowing what kind of complex math is going on to calculate the translations. Using OpenGL for this only makes sense if the GPU is really the bottleneck. I would suspect that this is not the case, but you have to test which parts are causing the skipped frames.
Generally, UIView and CALayer are implemented on top of OpenGL, so animating the translation of a UIView already makes use of the GPU.
As an aside, using CADisplayLink instead of NSTimer would probably be better for a game loop.
The problem with the iPhone simulator is it has access to the same resources as your mac. Your macs ram, video card etc. What I would suggest doing is opening instruments.app that comes with the iPhone SDK, and using the CoreAnimation template to have a look at how your resources are being managed. You could also look at allocations to see if its something hogging ram. CPU could also help.
tl;dr iPhone sim uses your macs ram and GFX card. Try looking at the sequence in Instruments to see if theres some lag.
I am developing iphone application similar to the Talking Larry Application. I am facing an issue of Low Memory when i pre-load the animations into an NSMutable Array. If i do not pre-load the animations and load it into the Animation Images when the user touch the button then it takes Time and it play back the animation very Slow. And during video making it does not play the complete animations. How can i resolve this issue. I want to play back the animations similar to the Talking Larry app and do not want to get Low Memory Issue.
You have to “juggle” the images, freeing those that are not needed and preload those that will be needed soon. The trick is probably preloading a decent number of images beforehand, so that the animation does not slow down when started. You have to experiment to get the right numbers.
And of course, it also depends on the image resolution. I don’t know Talking Larry, but if you are trying to animate full-resolution retina images, it might be too much for the machine.
My designer has made a few animations for a flash game and I want to put them in my Iphone game. Is there any way to do that?
I thought of exporting all the pngs as frames. And then looping them in UIIMageview. Is there any better method to do this.
I am doing what Walter above has suggested.
Exporting the frames as pngs and then making them loop is probably your best bet then. – Walter Dec 24 '10 at 22:34
Not really. In the future you might be able to export Flash to iPhone binaries, but I think that project got put on hold when Apple changed the AppStore guidelines. Even then I don't think it would allow it to be emmended in another App.
Have you heard of Hirameki? It is a flash animation only parser that lets you drop SWF animations directly into Xcode projects for iPhone. A demonstration and beta sign up is here http://www.flash-on-iphone.com
I have a set of tiled image collections created via Microsoft's Deep Zoom composer, and a Silverlight application that currently consumes them for display via MultiScaleImage - it's all working pretty well - I'd just like to get some experience with iPad programming and
have a couple of ideas for some iPad applications. All my ideas rely on me being able to display/manipulate these tiled image sets (on the iPad).
I just picked up a iMac to facilitate this. I'm not seeing any Objective-C / Cocoa-touch libraries for this though, so am assuming I will have to roll my own. (I saw the Seadragon Ajax component, which is pretty slick, but I'm dealing with collections here, which it doesn't support. I would also like to roll this as a native application just to get the experience.)
The only open source project I found for displaying/manipulating the tiled image sets was Openzoom - a Flash component. I'm not to familiar with ActionScript either (Python, Java, C#, and c are the only languages I have really used), but briefly inspecting the code I didn't really have any issues with it and can probably use it for hints on how to swap the tiles in and out, etc. But, as I'm pretty new to Objective-C/Cocoa-touch, some pointers in the right direction would be appreciated.
1) Are there any other projects out there I am missing, or is OpenZoom my best bet for some reference?
2) Should I be trying to do this display in the UIKit framework, or should I do it as an OpenGL display?
3) Any other suggestions/pointers that I didn't think to ask.
I have just been working on a few apps that rely on tiling large images to allow for deep zooming. I found a couple of examples but the best and most useful for me was Apple's "PhotoScroller" sample code.
It relies on CATiledLayer to handle the tiling. The result is an extremely smooth and responsive interface even with very large images and its not too complex. (A little complex but not too bad).
So to answer your question directly:
PhotoScroller Code
QuartzCore Framework (which is part of the SDK)
There is a great, free little mac app for slicing images into tiles that I use a lot: "Tilen"
In the WWDC 2010 source samples, under iOS, there is a project in the ScrollView Suite called Tiling. It corresponds to WWDC10 session 104. It is probably the best image tiling example out there.
You can take a look at they way RouteMe library does this, the dynamic loading of higher resolution tiles, panning, etc. https://github.com/route-me/route-me
I can't believe nobody has told you about UIScrollview; the UIScrollView component is designed for this very purpose! (think Google Maps, which uses it).
Check out the class reference...
UIScrollView
The delegate method you require is the following....
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
This allows you to check the zoom level, offset etc and then provide a view for zooming. This way you can maintain your 'position' within the tiled landscape independently of the graphics used to represent it.
Don't roll your own UIScrollView, no need to!
Take a look at CATiled Layer. See my answer to a similar question here: Drawing in CATiledLayer with CoreGraphics CGContextDrawImage