Achartengine pan with animation - android

I want to make the chart of achartengine to smoothly move while panning, and animate while I programmatically changes axis display range. Searching through the documents, there seems to be no provided function to achieve this. Is there a way to do this?

You can definitely do this by changing the display area in a separate thread than the UI one, calling mChartView.repaint(), waiting for 20 ms or so then repeat the above.

Related

How to achieve translate animations sequentially

Hi i am new to android can anyone please help me to achieve object animations one after the other sequentially, i have four set of images should repeat sequentially without the the gap between the end and start of the animation means it should look like continuously moving from right to left.

Android 2d and 3d synchornization

Is there any way to synchronize 2d and 3d animations in android.
Let me explain:
i want to run a normal zoom/move/ animation of an android widget using surface view.
Same time i want a 3d cube rotation using Glsurface.
Can i achieve a parallel animation effect.
Thanks in advance.
It all depends on how you implement the animations. It could very well be enough to set the duration of both animations to exactly the same, and then start them at the same time.
As far as I know there is no "AnimationProgress" listener that you can use to get how far the 2d animation has progressed, so if you need a very exact synchronization of the two animations, you might be best off running your own animation thread updating the position of both objects continuously.

How do you draw a slash animation on an android phone?

I would like to draw a slash animation between 2 points that I have already randomly generated.
The animation can be as simple as the line extending to the other point over a set amount of time. I would like the animation to be a "pretty" line so I was using a bunch of images and iterating over them and not just canvas.drawLine(x, y, u, v, paint).
The main issue I am running into is the points are not always the same distance apart or same direction. Im not sure if having a set number of animation sequences would work because of those differences. What is the best way to do this?
Not sure if this has been answered, but you'll have to say how complicated your imagery is. If it's a simple slash line, then drawLine would work. You'll also have to say how you are animating the line, like Android XML or if you are using some sort of timer.
There's so many ways to do this. If it's a simple line, you can use math to increment some coordinates. Watch out for using frame counting, where you say "increment the animation for the frame". It's a quick-and-dirty way to animate, and sometimes will get the job done.
A lot of video games use time-based drawing. "If this amount of time has elapsed since the last draw, draw this much". The result looks much more natural and the same between devices with different amount of horsepower.
There's also what you are drawing on. Are you using a View or a SurfaceView? The list goes on.

Help me optimize this graph animation

I need some help with this simple animation on my Android phone. I'm a newbie with animation and graphics.
I'm graphing accelerometer data as a sliding time series window. As new accelerometer data is read, its data is plotted on the right, pushing previous data to the left, as shown below:
My program is running pretty smoothly, but I would like some help optimizing the animation. Here are my main concerns:
My current implementation reads all the accelerometer data in one thread and keeps the data in a fixed-size FIFO queue to capture the width of the time series window. I then use Timer.scheduleAtFixedRate() to plot out the entire contents of the queue so that the whole graph is re-drawn every 50 milliseconds. Can I improve upon this? Do I really need to re-draw the graph so often like this? In another similar program I've seen, each pixel column is copied to one pixel to the left, rippling down the graph; the newest data's column is drawn on the far-right pixel column. Is this better?
I redraw the legend (in the upper left) in the drawing thread that runs the draw function every 50 milliseconds. Is there any way to "keep" that legend in place instead of having to constantly re-draw it?
Any other help would be appreciated. I have heard of optimizations like double-buffering but am clueless if that would help me.
If the legend and the cross hairs only need to be drawn once, then you should place it into a buffer bitmap. For your graph line maybe try using the Path object to plot the lines. When it gets time to draw the lines just drawLine to the appropriate point and then translate the canvas left appropriately.If

How to animate views?

I'm working on a game that in some ways is similar to Tetris (imagine a 2D array of colored squares that sometimes move around)
I am trying to animate the individual squares so they will smoothly slide down from coordinate to the next. Since I wanted to use Android's built-in tweening feature, the animation has to apply to the whole View (rather than parts of it). This doesn't work well for me because I only want some of the colored squares to slide down, and the rest of them to stay still.
The (theoretical) solution I came up with to resolve this is to make 2 Views, layered directly on top of each other. The top view is for animating squares when they need to move, and the bottom layer is for the static squares. The animation-layer is transparent until I am ready to animate something. I then simply turn on the colored square in the animation-layer, tween it to the new location, and turn it back off when done. In the same time span, the static-layer just turns squares on and off at the right time to make the whole thing look seamless to the end user.
The proposed solution is just a theory, since I haven't been able to make it work correctly yet. Since I have been having trouble, I was wondering if this is even the best way to solve the problem? Perhaps there is a more elegant solution that I am over looking? Anyone know of a better way?
If you just want to animate a single element check out the namespace android.view.animation.Animation. You can also use Drawable shapes and draw them directly. Finally, if you want a simulation then you will have to look into threading. Basically you will create a timer to update the canvas for you based on an interval. There are some other view canvases you can use as well like the GLView canvas.

Categories

Resources