23 posts / 0 new
Last post
pankaj
pankaj87ojha@gmail.com's picture
Offline
Joined: 22 Sep 2010
Posts:
Animated screen

I want to create an animated screen eg, rotating a ball in a screen

Please give me solution quickly

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Niklas Nummelin
niklas's picture
Offline
Mobile Wizard
Joined: 18 Dec 2007
Posts:

Do you mean that you want to use a MAUI::Screen (the UI component) or just do it by doing regular drawing. Do you want to draw an animation or do you want to render the rotating ball in realtime?

Usually, if you're using the event-driven Moblet architecture, you want to register a timer and update the screen at every tick.

// Niklas

pankaj
pankaj87ojha@gmail.com's picture
Offline
Joined: 22 Sep 2010
Posts:

Thnx for the reply..
I want to draw an rotating animated ball in MAUI::Screen

Plz give the solution quickly

Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

Hi Pankaj,

There is an AnimatedImage widget in MAUI. You need to create an image with all of the frames in it, and then provide co-ordinates to tell the widget how large each frame is. You can then use this for the animated ball.

cuongvn_it
cuongvn_it's picture
Offline
Joined: 4 Mar 2011
Posts:

I have this way ,I want to yous evualuate it.I have uploaded file to yous see .

AttachmentSize
AnimatedImage.rar 817.46 KB
cuongvn_it
cuongvn_it's picture
Offline
Joined: 4 Mar 2011
Posts:

I have builded a GifImage class support for display images list.

mona1234
mona1234's picture
Offline
Joined: 13 Dec 2011
Posts:

Hi !

mona1234
mona1234's picture
Offline
Joined: 13 Dec 2011
Posts:

I want to animate an Image in Mosync, but the image not animating. i have used a following code.
can u give me any reference?

#include
#include
#include
#include

using namespace MAUtil;
using namespace MAUI;

#define RES_FRAMES 1

class MyScreen : public Screen
{
public:
AnimatedImage* img;

MyScreen() : Screen()
{
img = new AnimatedImage( 0, 0, EXTENT_X(maGetScrSize()), 150, NULL, RES_FRAMES );
this -> setMain( img );
}

virtual void show()
{
img ->setDirection( 270 ); // maybe 180?
img ->setFps( 1 );
img ->setFrame( 0 );
img ->setFrameHeight( 800 );
img ->setNumFrames( 5 );

Screen::show();
img -> start();
}
};

class MyMoblet : public Moblet
{
public:
MyMoblet()
{
MyScreen *s = new MyScreen();
s->show();
}

void keyPressEvent(int keyCode, int nativeCode)
{
if (MAK_BACK == keyCode || MAK_0 == keyCode)
{
// Call close to exit the application.
close();
}

}

void keyReleaseEvent(int keyCode, int nativeCode)
{
}

void pointerPressEvent(MAPoint2d point)
{

}
};

extern "C" int MAMain()
{
Moblet::run( new MyMoblet() );
return 0;
}

Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

Hi,
There is a bug in the MAUI AnimatedImage widget. Have a look here, and use the fixed code.
https://github.com/MoSync/MoSync

Thanks

mona1234
mona1234's picture
Offline
Joined: 13 Dec 2011
Posts:

#include
#include
#include
#include

These are included files and image is.

stars.gif
mona1234
mona1234's picture
Offline
Joined: 13 Dec 2011
Posts:

Thanks !

mona1234
mona1234's picture
Offline
Joined: 13 Dec 2011
Posts:

Hi , I used ur Animtest project, it works really well. Now i want to calculate fps of that animated image. can u give me any reference?

Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

Hmm, I'm not sure I understand. With AnimatedImage you set the fps you want it to have, not measure how many it can do. e.g myAnim->setFps(3);

mona1234
mona1234's picture
Offline
Joined: 13 Dec 2011
Posts:

I want to calculate fps of animated image which varies per sec , just like in QUQKEMDL project in Mosync.

mona1234
mona1234's picture
Offline
Joined: 13 Dec 2011
Posts:

In QuakeMDL project, fps is shown on the screen. just like that I want to show fps of animated image on screen.
can u give me any reference? pls.

Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

The difference between AnimatedImage and QuakeMDL is that QuakeMDL paints as fast as it can, so the fps is an indication of the speed of the software, device and model. With AnimatedImage, it animates at the rate you've set, even if that is 1000 fps. It may not finish a paint in 1/1000th of a second, but it will attempt it. There isn't a way to test the fps of AnimatedImage because it is fixed to the value you set.

mona1234
mona1234's picture
Offline
Joined: 13 Dec 2011
Posts:

OK ! it means we cant get fps of animated image.

Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

You can, but its an instruction, not a measurement

int fps = 10;
myAnim->setFps(fps);
printf("Animation FPS %d", fps");
mona1234
mona1234's picture
Offline
Joined: 13 Dec 2011
Posts:

Hello ! I have used code of Downloading Images from Intrenet and it works. but its not working for animated image.
I want to download animated image. can u pls give me any solution.

Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

Hi,
is it working with locally stored animations? There shouldn't be a problem if you know the size of each frame. There has been a bug in some versions AnimatedImage, and I'm not sure which versions are fixed. Try it with a local animation first, and then see if you can do it again with downloading the same image online. Have a look here http://www.mosync.com/content/animation

mona1234
mona1234's picture
Offline
Joined: 13 Dec 2011
Posts:

My problem is when I download simple image it works,
but when i download animated image it is giving panic error 40001.
invalid resource type.
I m using Mosync 2.7.

Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

But does it work if the animation isn't downloaded, and you've added it as a resource to the project?

Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

I can't email you back, you've exceeded your quota. Here is the email I tried to send

Many platforms don't support viewing gif images. When you said that your animation doesn't work, did you mean that your animated gif doesn't work? Animated gifs are only supported by the browser in a native WebView control.

AnimatedImages aren't as well documented as I thought they were. What you need to do is to create a single image, with each frame the same size and width, and each frame aligned vertically. You tell the AnimatedImage widget the height of each frame, and the number of frames per second you want it do, and when you want it to start and stop.