|
|
Overview
Kairos is an ancient Greek word meaning the "right or opportune moment". The ancient Greeks had two words for time, chronos and kairos. While the former refers to chronological or sequential time, the latter signifies "a time in between", a moment of undetermined period of time in which "something" special happens. What the special something is depends on who is using the word. While chronos is quantitative, kairos has a qualitative nature.
From the Wikipedia definition
We used to consider frame as an invariant unit, each frame is the same than the previous one, but in fact the Flash Player can't guarantee that all frames have the same duration, and that an swf may always run at the same speed. Kairos is inspire by real-time simulator design where computer side effects such freeze and lag have to be reduced to prevent the user experience and where engines are build on real world unit and real world equations.
Understanding time in Kairos
Kairos time management is quite different than how Flash usually work. The main difference is that all objects works on a second-based unit, result that the accuracy of some animation or callbacks, such as in MovieClipRT, IntervalRT or TimeoutRT classes, is lower than what the Flash Player offer. This approach fit well to game or simulators where perceived speed of the animations and synchronisation between events and animations is a big part of the gameplay.
Kairos Components
Kairos is based on Pixlib, so you will find all objects you commonly use such Beacon, Tweens and Command Managers. All thoses objects are declined in RT (real-time) versions. The main difference is that the RTBeacon pass a RTEvent with the onEnterFrame call, then objects use the data stored in the event to compute their animation.
But Kairos also provides new objects witch are designed to cover more aspects of animations and time in Flash.
MovieClipRT, AdvancedMovieClipRT and FrameControllerRT
- The MovieClipRT and the AdvancedMovieClipRT objects handle Movie Clip animations by pluging it on the RTBeacon object. With those tools you can animate mc at the speed you want wathsoever the speed of the swf. The main differences between the two objects is that MovieClipRT have less computation and fit well for simple animation play, when AdvancedMovieClipRT can control looping and frame range.
- The FrameControllerRT add code execution on Movie Clip's frames by using commands. You can register a command with a frame and then let the controller trigger action when passing on the frame as in the Flash IDE.
MovieClipRT and the AdvancedMovieClipRT use the strategy pattern to perform all types of animation (loop and reverse). A play strategy simply says when an animation stop and witch frame is the next frame according to the elapsed time since the last routine call and the current object framerate.
IntervalRT and TimeoutRT
With a Beacon system, all objects have to run according to the orchestra conductor. If it stop, all objects stops. But when using interval and timeout at the same time than a Beacon its a real brain teaser to stop them correctly.
IntervalRT and TimeoutRT simply encapsulate those routine in beacon plugged objects. Now intervals or timeouts stops automatically when Beacon stops.
Demos
You can find a demonstration of Kairos functionnality here.
This demo show how you could obtain framerate independant animations using objects contained in Kairos.
Documentation
You can find the complete documentation of Kairos classes here :
ChangeLog
Sign in to add a comment
