Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple animation 1

Status
Not open for further replies.

Bussotao

Programmer
Mar 26, 2002
11
BR
Hi,
I'd like any suggestions about the best form of creating an animation with a simple figure, for example, a pendulum.
Is it possible to load an image of a simple pendulum and after some calculation of its angle, rotate the image to produce the animation?
Is a simpler way to do this?
Thanks a lot.
 
You can create the animation writing the code, but this is not the easy way,
Or you can create the animation with other tools like Macromedia Flash, Dreamweaver, etc, then export it as avi file and loadint in bcb as an animation (video, or TAnimation)



---LastCyborg---
 
I agree. If you are creating this for a project at work or home, it would be much easier to use a graphic editing program to create the video and display it as such in the software. It would be more efficient and less strain on the processor and display refresh.

If you absolutely have to do it by calculating angles and re-arranging bitmaps to those angles, there was a comment from an earlier thread somewhere that said something about paying more attention in Geometry or calculus or something. Well anyway, that applies here (math makes my head hurt, someone give me a tylenol!), would be a fun project to undertake though! Let us know what you do if you decide to do all that. :)

Good luck,
Chris
 
The simplest (but not memory efficient) is to create each frame before hand and load each one into a TImageList. Then you can make a TImage flip through them with a TTimer using:

ImageList1->GetBitmap(frame_index, Image1->Picture->Bitmap);

A more memory efficient way (and really ugly) is to use trig to figure out where to draw the bottom (whatever that round thing is called) and then connect a line to it. You'd have to lookup the equation for the timing though.
 
Hi, people:
First, thanks a lot for your help
I really need to make all the calculations simultaneously with the calculations, just because my final interest is making animations which don’t have any periodicity, (so called chaotic).
The calculations are ready I have the equations and the angles as a function of time and I can adjust its timing.
So, I’m really considering to do it by the hard method.
Can you give me the firt steps?

 
There are many ways to do that, u can do it using open GL or DirectX, I think that using other ways you'll see the flipping.

Well I think that depends of the kind of application you are doing too.

is this a game, a presentation of a program?



---LastCyborg---
 
Hi,
Really, forget about the rotation of bitmap - it is too expensive and looks ugly =)
Perhaps the best method is drawing it yourself. If you want just a basic shape, simple TCanvas (GDI) calls will do. But if you want a really nice real-time graphics then you can not avoid OpenGL! If you are not familliar with it, then it might be a problem, but, believe me, it is worth of learning =)
 
Ok, guys:

What I want is a simple program presentation, but I'd like it to be nice...
I think I'm going to start by drawing simple objects with canvas.
With time I'm going to check the open GL. However I need an relatively easy start. Can you recommend any site or online tutorial or whatever?
You all have been great.
Thanks,
Marcelo
 
Hey I have read some interesting articles lately on 2D images. Check this book out from Amazon. They scanned in the chapter on 2D imaging. You can read it and learn how to rotate, scale, and translate simple lines and polygons. I'm definitely buying the book for later on. :) Anyway, as I was reading it last night, I thought this is definitely along the lines of what you are looking for.

Go to Amazon and search for Direct3D Programming Kick Start.

Chris
 
Hai!

"However I need a relatively easy start."

If you want to learn 2D graphics the GDI+ library might be reasonable starting point (and following point too :). It is not complicated as GDI (SelectBrush things). You can access full documentation at Microsoft site.

Windows XP has already got GDIPLUS.DLL but you can find support at Microsoft site for earlier win versions.

To link GDIPLUS.DLL to your Builder app use the IMPLIB command line utility.

Enjoy,

Unborn
 
I found a C++Builder applicatio donig almost what you want
Are u still interested?
Note:
This is not a little file.

--- LastCyborg ---
 
Hi, lastcyborg:

I was off my activities in programming but I'm still interested in that application you mentioned. Do you still have it?
Sorry for so long...
 
if you just want to use the canvas look into its drawing methods.

Such as
this->Canvas->Ellipse()

it should be what you need.
Quick and dirty
 
The problem using that way is that you will se the flicker when updating the image

--- LastCyborg ---
 
Howdy,

I did an application with OpenGL that had all sorts of physics demonstrations in it. It has a 3D pendulum, and several other animations all calculated dynamically based on user adjusted values. If you are interested in checking it out, plz reply...

onrdbandit
 
Howdy,

Download a zipped archive at:


Copy that address into a browser's address bar, it wont work by clicking it...

You will need to install the TOpenGLAPPanel from the install package in the OpenGL AP Panel folder...

Then you SHOULD have everything you need to build the project file. Im not too good at remembering what is necessary to built projects, so if it doesnt work, let me know and I will try again...

Good luck,
onrdbandit
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top