I want to make series of images along with the path that between the points touch begins and ends.
So, I tried CCRibbon, it makes series of images along with touches, but I can't reduce the gap between images.
Actually I want to make no gaps or overlapping images.
Then, I tried another example using CCRenderTaxture, it makes beautifully what I want,
BUT it makes gap too when touch moves fast.
So, for me, it becomes very very hard problem.
Is there Anybody has advice for it or an example.
I really appreciate.
Related
I have been developing line drawing apps that produce lines such as these:
I really want to draw lines such as these:
I dont know what technique is used to produce the lines that look like brushwork.
I would appreciate advice, or redirection to a post that looks at this question. I've looked for an hour. I dont know the terminology to ask the right question..
Thanks
You have two problems you need to solve:
How to determine the width of the line to be drawn
Drawing the appropriate width line
Ideally you would want pressure information from the user's finger to know how wide the line should be. The harder the user presses, the fatter the line. However, the capacitive touch devices that run iOS don't have the ability to get this information. So your next option is to use some algorithm based on how fast the user is moving their finger on the screen. Slow movement may mean fatter lines and fast movement may mean thinner lines. Or the reverse, depends on what you want to achieve.
Drawing the appropriate width line has many options depending on whether your app is using OpenGL. Mainly, I would look at using a small anti-aliased circle image that is used to paint into a pixel buffer. Scale the image appropriately to paint sections of the line at varying widths. This part of your question has a lot of options so you may want to ask it as a separate question while also including details of whether you're using OpenGL, Core Graphics or something else.
I am working on a iOS 5 iPhone project where users can choose an image on their device, then trace an object inside of the picture (trace an apple out of a picture of a fruit basket), and then the picture needs to be uploaded with the "tagged" object so it can be pulled down later. Other people will then pull down the image and try to find where the tagged object is in the picture (Think "Where's Waldo?").
I have been trying to figure out the best way of tracing the object. Before, I had a user press the top left, top right, bottom left, and bottom right points around the object and create a square view around the object. The info for that view was uploaded and then pulled down for the user to find the object. The downside is that all objects are obviously not squares/rectangles so I need to do a free form shape.
I was thinking of allowing the user to draw over the object and then somehow I need to be able to tell what is inside of the trace (For example, inside of a circle that they traced), but a problem I forsee is making sure the trace they made is closed so I can fill in the shape (which is a whole not problem).
Any advice welcome on the best way of starting this.
Thanks!
UIBezierPath might be a very useful friend here. It allows you to create any shape you need, and it supports both drawing and hit-detection. I recently did an implementation for a storybook where I could trace out a shape with their finger, freeze it, and then use the shape for tap detection.
The basic idea is this:
When your finger touches the screen, start recording positions. Discard any positions that are too close to the previous position (eg, only record a point if it is >min-distance from the last recorded point). While doing this, you can draw the UIBezierPath so you can see what you are tracing out. Modify the UIBezierPath by adding points to it, instead of recreating it every time.* When you lift your finger, close the bezier path. Quite simple.
Now, this will result in a polygon (ie, straight edges). If your min-distance is low enough or if you are using it for hit-detection (as you say), it won't really matter. However, if you want to smooth the path, you have to use the curve-to methods, which slightly complicate it - but should you wish to follow up on this more, read up on splines and spline generation from a point series.
*note: otherwise you'll get lag while drawing large shapes because recreating a bezier path from an increasingly large series of points gets expensive. Modifying the existing path makes it much, much, much faster.
How do you create filled flat circles (say white) that build out from each other in random overlap to fill the iPhone screen but ease-dissolve so that the screen never gets filled - on touch? On touch release they stop being created as they continue to ease transparency to 0 and are cleared from memory.
An example in code would be killer.
What you're doing shouldn't be too hard to do, but it would take some time to actually code. I'd be surprised but impressed if anyone were to make an example for you.
You could probably figure this out for yourself and learn some pretty good coding lessons on the way.
In order to do what you want, you need a pretty good handle on some concepts such as these:
(Cocos2d)
Touch Detection
Drawing Shapes
Random Numbers
Opacity
Timed Fade Animation (Your "Ease-Dissolve")
and utmost important:
**memory management!**
I'm using cocos2d for the iPhone to create an infinitely scrolling horizontal tile map. To achieve this, I've generated a library of 'segments', which are basically horizontal chunks of levels that I randomly choose from and append to the end of that particular levels tile map. When tiles scroll off of the left of the screen they are removed from the layer and released. This all works fine.
My question revolves around the legitimacy of the scrolling method I've chosen. Following guidance from this article, I've been scrolling my map by updating the layers position at regular intervals (subtracting from the x axis to move the layer to the left). And while this works, I'm concerned that there's probably some finite limit to the positioning of a layer. Am I going to run into issues after a certain amount of time has passed (when the layers x-axis position is considerably large?)
Any thoughts on my approach would be appreciated.
This is a good question. What I would do is run some tests on how far you can position the layer. I placed a sprite and focused the camera to ccp(1000000000000000, 1000000000000000) with no issues.
Do you really think this would be an issue in real gameplay? Seems like it would take a very long game to reach a position like that.
I hardly know how to explain my case other than to point to the excellent Absolute vodka app, Drink Spiration.
I am trying to make a carousel like image browsing with a little spice. I would really like to find a simple core animation explanation on how to accomplish something like the above app.
I hope someone can help with this. The solution doesn't have to be exactly the same, but just explain what is happening and it would be best if it was simple and no opengl. Just something to point me in the right direction. I don't think using just a scrollview with uiimageviews is enough.
I wrote something similar and its quite easy once you figure it out in your mind. All done justing using regular old views and animating transforms on them.
Say its 3 images on screen, and you can rotate new ones on and off ... then you will need 5 views set up (most simply just a UIImageView with a relevant image set). They are the currently selected image, the two either side of it and the ones that are, or will be animating on or off when the user flicks left or right.
Each of these 5 images has a position, an angle and an image. When the user flicks left or right each gets animated to the next position and angle, views that are about to come onscreen have their image updated to the next image in the set. If the user keeps on flicking in the same direction you simply reposition views on one side as they come off the other.
With this setup you can do lots of cool carousel like things very simply.