Re: Drawing and Animation (using Timers?)
From: Justin Rogers (Justin_at_games4dotnet.com)
Date: 08/21/04
- Previous message: Phil Jones: "Drawing and Animation (using Timers?)"
- In reply to: Phil Jones: "Drawing and Animation (using Timers?)"
- Next in thread: Phil Jones: "Re: Drawing and Animation (using Timers?)"
- Reply: Phil Jones: "Re: Drawing and Animation (using Timers?)"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 20 Aug 2004 23:38:21 -0700
You need some sort of timer to activate the animation logic. The recommended
approach is to use a single high frequency timer that checks each animation
sequence
for a frame advance. A simple example might be:
50 ms resolution timer
Animation Sequence 1: 10 fps (100ms) with some variant frames of +/- a few ms
Animation Sequence 2: 0.5 fps (2000 ms) with some portions of the sequence at
10fps
The general logic here is as follows:
1. Upon each timer elapse check the sequences for a frame advance.
a) Simple: Current Time > Next Frame Time
b) Complex: Current Time > Next Frame Time or Next Frame Time within X ms of
Current Time
2. If a frame advance is encountered then call the rendering logic. Rendering
logic should consist of:
a) Compute clearing regions
b) Invalidate or Direct Copy of new assets
3. Compute next Frame Advance
The logic here uses a single timer to manage multiple sequences. The ability to
dynamically change the
timing between portions of an animation sequence is key. For instance, you might
have a sequence that
displays a characters face for 2 seconds, then updates the mouth for half a
second at 10fps, and then
shows the face again for another second. Each step in the animation sequence
requires timeslices of
varying lengths. Setting up multiple timers for this is a pain and error prone.
Having a single logical timer
simplifies the situation.
If you are interested in something more complete I might write a small article
on this. Contact me through
my blog if you are interested and then I can drop you a response once the
article is posted.
-- Justin Rogers DigiTec Web Consultants, LLC. Blog: http://weblogs.asp.net/justin_rogers "Phil Jones" <phil_newsgroup@hotmail.com> wrote in message news:O6HjcexhEHA.396@TK2MSFTNGP12.phx.gbl... > I'm just wondering, in regards to animating a sequence (for instance I'm > looking at creating some sort of visual transformation between states wtihin > the control - like sliding things around) what's the general approach to > take? > > I'm thinking of using Timers to force redraws of the control - and then > successively paint the thing. But is there a more efficient or correct way > to use the Drawing framework to achieve this type of thing? > > Thanks everyone. > === > Phil - NZ > > >
- Previous message: Phil Jones: "Drawing and Animation (using Timers?)"
- In reply to: Phil Jones: "Drawing and Animation (using Timers?)"
- Next in thread: Phil Jones: "Re: Drawing and Animation (using Timers?)"
- Reply: Phil Jones: "Re: Drawing and Animation (using Timers?)"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|