Maybe is there a way to do animation only on one image?
So if I have an UIImage and I want to animate it like a wave. Is this possible? And if yes, can you give me some examples or a link to start or something like this? (I used google but didn't find any good start link...)
OpenGL ES is another possibility. Apple provide all the code to set up a rendering context.
From there you just need to get your image into a texture, define some vertices (more than just four), and move each vertex on a sine wave.
Yes - you may want to look into cocos2d - http://www.cocos2d-iphone.org
or OpenGL ES as mentioned above
or Quartz
It all depends on what this 'Wave' effect needs to look like, if it's what i think, you couldn't achieve that by using Core Animation, you would need to look in to these suggestions.
Related
I have a UIKit app (no OpenGL included yet) and I need to blur an image in there. Some people suggested to go with OpenGL texture blur for this. There's an sample project from Apple called "GLImageProcessing" but it's such a huge source base and filled with just too much of different stuff.
Maybe someone knows another source that showcases the texture blur on it's own, making it simple to follow the process how to set up an EAGLView that just does that one thing?
You probably want to apply a Gaussian blur effect. Here's a library somebody has provided to do this on a UIImage:
http://code.google.com/p/simple-iphone-image-processing/
I am trying to draw individual pixels in xcode.
I already know Objective-C but not the Quartz/graphics stuffs and I'nm not interested at the moment. I simply want a basic app that let me have a map of X*Y and being able to show pixel at (x,y) with color rgb.
I don't know how to find a tutorial for this, and I think it must be very quick. Do you guys have a file like this, or could point me to a tutorial?
Any help is greatly appreciated.
Simply use NSBitmapImageRep with setColor:atX:y:
Create a empty NSBitmapImageRep.
Every time you need to update the view do something like this:
- Set the specific pixel to a certain color with setColor:atX:y:
- Convert NSBitmapImageRep to NSImage
- Show result in a NSImageView
This works perfect if you don't need to update the view too many times/sec.
I already know Objective-C but not the Quartz/graphics stuffs and I'nm not interested at the moment. I simply want a basic app that let me have a map of X*Y and being able to show pixel at (x,y) with color rgb.
If you're not interested in learning Core Graphics, then tough luck. You get two choices for graphics: OpenGL, or UIKit/Core Graphics. Your choice, but Core Graphics is considerably easier. You can use OpenGL to paint on a per pixel basis, but I'm assuming if you have no interest in learning Core Graphics you're probably not going to be keen on OpenGL. For high performance applications you're looking at OpenGL as the only realistic option.
So, if you don't want to learn OpenGL your best bet is the Quartz programming guide:
http://developer.apple.com/library/ios/#DOCUMENTATION/GraphicsImaging/Conceptual/drawingwithquartz2d/Introduction/Introduction.html%23//apple_ref/doc/uid/TP40007533-SW1
Out of interest, why wouldn't you want to look into Quartz?
You could either use CoreGraphic to draw a filled rect in a drawRect after a setNeedsDisplay on the view. Or you could generate a bitmap context and assign it to the layer contents of your view at a 1.0 scale if you want actual pixels instead of 1x1 point rectangles.
I'm trying to create a "page curl" animation of an image in my iPhone application. I t UIViewAnimationTransitionCurlUp, and it's undocumented Core Animation siblings, however the image I need to animate is a transparent PNG, with "uneven" (some alpha pixels) outlines. When using the aforementioned pre-made transition, those alpha pixels are painted black as soon as the animation starts, which looks terribly ugly.
Therefore, I seek to create a Core Animation of my own. I have tried to research the subject, but have been unable to find a good overview of the techniques involved. The implementation would of course have to be more complex than a single property change, I get the feeling that even CATransform3D would be to limited for this purpose, as the image needs to have different 3D transformations applied in different parts of it - changing over time. How would one then go about this subject? I'm very grateful for any thoughts or ideas!
Best,
Eli
As Corey points out, you'll probably need to go with OpenGL ES for this one. Core Animation exposes the ability to work with layers, even in 3-D, but all layers are just rectangles and they are manipulated as such. You can animate the flipping of a layer about an axis, even with a perspective distortion, but the kind of curving you want to do is more complex than you can manage using the Core Animation APIs.
You might be able to split your image up into a mesh of tiny layers and manipulate each using a CATransform3D to create this curving effect, but at that point you might as well be using OpenGL ES to create the same effect.
The book Core Animation for Mac OS X and the iPhone: Creating Compelling Dynamic User Interfaces from Pragmatic Programmer may help you write custom Core Animation animations.
I have a straight image and I want to deform it in a wave-like manner.
Original image:
straight texture http://img145.imageshack.us/img145/107/woodstraight.png
and I want it to look like this (except animated):
bent texture http://img145.imageshack.us/img145/8496/woodbent.png
I haven't tackled the learning curve of openGL yet so if I can do this with Core Animation it would be great.
Is this possible?
Unfortunately, I think this is a job for OpenGL. You could achieve the same affect in Quartz by slicing the image up vertically and drawing segments with different vertical offsets... but I don't think you'd be able to achieve good enough performance to animate it. (At least, with 1px or 2px wide slices)
You could also leave the image stationary, and use Quartz to animate a masking path that would create the waving edges. That probably wouldn't look too natural, though.
As far as I know, Core Animation on the iPhone isn't capable of doing this, either. On the Mac it comes with some more advanced filters, but I think you'd probably see a lot more stuff like this if the iPhone filters could do it :-)
OpenGL does have quite a learning curve, but here's what you'd want to do to achieve the effect: Create a flat rectangle in OpenGL with several verticies along it's length. Point the camera at the rectangle so that it appears flat. Then, use a sine() function of some sort to animate the verticies back and forth in place.
This approach is also used to achieve the rippling-water effect, and you might be able find an example or two of it.
Sorry to bring bad news :-) Hope that helps!
I need to create good looking lightning using OpenGL ES 1.1 (iPhone) and was planning on using shaders. However, when I asked about it in a previous question (OpenGL ES 1.x Shaders) I was informed there that this was probably not an option on the iPhone.
So now I am back at square one, wondering how I might make a lightning animation. It does not need to look ultra-realistic. I have already tried to use things like triangles stripped together. While this method does work, it is not as good as I had hoped it would look.
Does anyone have any ideas on the subject?
Thanks again,
~Eric
Try using a triangle strip textured with a gradient from black to a low-saturation blue or purple, to white. Set your blending to additive (GL_SRC_ALPHA, GL_ONE).
The usual approach is to compute the path of the lightning bolt using a Perlin function, rendering it to a glow buffer, creating a nice looking blur using a Gaussian blur shader and then merge it with your scene.
You could maybe adapt the code from this project. Although it's not ObjC/C, it does use OpenGL.
Here is an article that describes the effect in more detail and provides a VB/DirectX implementation.
Maybe I'm missing something but what's wrong with simply using glLight() and the fixed functionality like everybody else?
Would have to be a very bright light to make it look like lightning and wouldn't you need to shine the light on or through something?