What's the simplest zoom function featuring "+/-" button in Lua [Corona SDK]?
My point is to have button (2 buttons, + and -) that does not change its size while zooming and to have overally smooth zoom that allows you to scroll background when it is zoomed. I'm basically new to coding, so I'm having some trouble with handling that. I'm making my first project (piano app), so I'd like it to be simple, I have been searching how to do that long, but I still couldn't find any exact readable sample of code which I would be able to use. How about your ideas?
Thanks
I do not understood what you want to do. But if you want to zoom an image you can change the xScale and the yScale property of an object. And you should insert the image object into a scrollview object to scroalling.
Related
So I'm working on piano app in Corona SDK (I'd like to say that I'm still a newbie to it). Basically the app layout is 'static' as I call it (there's no any scrollview etc.). Keyboard is situated on top of the screen and it covers like 1/5 of whole background, so every key is tiny, unplayable. And I don't know how to make zoom function containing buttons feature. If out there would be 2 buttons; one with '+' and one with '-', situated in bottom's 2 corners. I want them to don't change their size and position while zooming. Then when it's zoomed, no matter how deep, app work would be easily scrollable. I'd love the both, zooming and scrolling to be smooth, so you were be able to individually select your playing setup in your own preference. Can you help me and give some code suggestions, please? (as I said before I'm new..)
Thank you
First of all I suggest you to look into group programming guide. As I understand you need to place Keyboard in separate group and use xScale/yScale properties to zoom it.
--setup keyboard
keyboardGroup = display.newGroup()
sceneGroup:insert(keyboardGroup) -- sceneGroup may have different name in your code
--insert keys example
keyboardGroup:insert(yourKeyObject)
Zoom function:
function setZoom(xValue, yValue)
keyboardGroup.xScale = xValue
keyboardGroup.yScale = yValue
end
Zoom buttons should be placed in another display group, so they will not be affected by scaling
I am trying to make the iOS slider as similar as possible to the Android one. One main difference is that on Android, if you click anywhere on the slider scale, the slider knob will jump to that position, while iOS it seems that you can only drag it to a position. Is there anyway to fix this?
I would like to do it using objective-C (which I am new to) and I'm not quite sure where to start. I understand the code used to store the slider value, but not how to change the method in which that value is obtained.
Any help would be appreciated.
The main idea is that you need to detect when the slider is being clicked on, and where it is clicked within the slider's boundary.
So if you can detect the x position of the click with respect to the slider's frame, then just divide it by the width of your slider, then you get a ratio of where it is inside the frame. Multiply with your max value of your slider and you are done.
Notes for implementation:
There are various ways to detect touches within a view. The easiest is just to overlay it with an UIButton. A more concise way is to subclass UISlider and use the touch events touchStarted, touchMoved, touchEnded to determine specific behaviour. You can find their specs in UIView's class documents.
Once you determine the new slider value based on your calculations, just set it using setValue: method.
Fairly new at android dev, haven't got any code for this particular step yet so ill try give as much detail as possible. I'm trying to make an ImageView object move around the android view/activity, unlike java im not able to use the random generator to translate it onto an x and or y position on the frame, if anyone could point me on the right direction or more importantly have a good idea on how to do this, that'd be great.
There is a class in android called Random. And there is a function called nextInt() which can give you a random number. You can also calculate the width and height of your screen using DisplayMetrices so that you can keep the image inside the device's screen. And you can also move the ImageView. See this link.
I want to create some kind of a tower defense map using a background image which is fourth as large as the screen of the device (twice horizontal, twice vertical).
my question is, how can I do this best. I'm new to Android, just got some Java basics , and want ti try out some stuff.
I want the user to scroll over the entire map using their finger and want him to zoom in via 2 finger pinch, and of course the objects (towers, sprites) should stay were they are.
I've been searching for hours for now and only found answers like " use Scrollview". I just want a food for thought to get in the right way, maybe with some examples.
You can use ImageView and set appropriate onTouchListener where you will detect pinch-to-zoom gesture using GestureDetector and change view coordinates when user drags the finger.
Is there any way to create a 360 degree object view from photos? I have a set of 71 photos of a single car viewed from different angles. I want to combine them and be able to rotate the car when touching the screen seeing it from different angles.
I've done researching but I couldn't find anything done in android. One example is found here
This example is made with Jquery. What I need is to implement it directly inside an android app. How can I do this?
Edit1: Until now I managed to create an animation between images in this way:
The problem is that the animation starts on click and works by itself. I want to be able to move the car from left to right and right to left when keeping the finger pressed and moving to right or left. How can I do that so I can see the car from the angle I want?
I just tested that Jquery plugin page on my device and it seems to work alright. So you could still presumeably use that plugin to make some html content that you could then load into a WebView. That would give the rotation thing inside of your application.
If you don't want to use html/javascript to do it you'll have to use an ImageView with a TouchListener attached to it that handles the drag events by swapping to the next image at the appropriate interval.
Or probably somehow with Canvas, though I am not as familiar with that, I would knot how to describe what you'd need to do to make it work this way.
After hours of trying to accomplish this task I stopped using the Drawable animation method because at point I was loading the images the app would of crashed because was out of memory.
Instead I found another way to do it which I use it right now. Example
I changed the .html with the images I need and the layout I want then I implement it inside my app using a webview. Is working pretty well.