Hello Rick,

in BoinxTV most of such time critical things that are triggered by events I 
implemented as a state machine in Javascript. A state machine is a program that 
has a certain state and keeps it for the next run loop. The state will only be 
changed if a certain condition is matched. In your case such a machine could 
look like this:

var oldString = "";
var currentString = "";
var startTime = 0;
var state = 0;

function (__string string1, __string string2, __number animationTime)
main (__number currentTime, __string newString, __number transitionDuration)

{
        var animationTime = 0;

        switch(state)
        {
        case 0: // wait for new string
        
                if(oldString != newString){
                        startTime = currentTime;
                        currentString = newString;
                        state = 1; // make transition to new string
                }
                break;
        
        case 1: // make transition to new string
                
                
                animationTime = (currentTime - startTime) / transitionDuration;
                
                if(animationTime >= 1.0){
                        // transition is over
                        oldString = currentString;
                        state = 0; // wait for next string
                }
        
                break;
        
        default:
                state = 0;
        }

        var result = new Object();
        result.string1 = oldString;
        result.string2 = currentString;
        result.animationTime = animationTime;
        return result;

}

find attached a little composition where this code is embedded. Just change the 
text from the "Message" input field to make it transition to the next text.

Attachment: text transition.qtz
Description: application/quartzcomposer


The big advantage of such a state machine is, that you can add more states to 
it without breaking the others. even if there are states that jumps to other 
states only for certain conditions, you are always sure that the other parts 
don't get affected. Also you can easily trace the "state" variable within your 
code to see if you finally arrives at the start again. This programming pattern 
gives you a very robust code. In this case nothing can dusturb the transition 
animation. Only when the transition has finished a new text will be accepted. 

best,

Achim Breidenbach
Boinx Software



On 17.06.2011, at 09:09, Rick Mann wrote:

> I've been doing these on-screen graphics for a web channel that covers space 
> launches. We show a couple of different countdown clocks, as well as a block 
> of ascent parameters.
> 
> But for the last nine minutes of a shuttle launch, there's not much to show. 
> I have a couple dozen events that occur at various times during the count. I 
> want to display each one as it occurs. An event is just a text string 
> describing the event ("APU Start," "Steering Test," etc.).
> 
> My custom patch can either output each string on a output port, or output an 
> array of structures that has the string and the associated time. The former 
> is easier for me.
> 
> How can I crossfade from the last event string to the next, especially when 
> they come in rapid succession (perhaps more quickly than the crossfade 
> duration)?
> 
> I was doing a similar cross fade between a set of images, and it was a real 
> pain to build the structure for it.
> 
> Thanks for any suggestions,
> Rick
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Quartzcomposer-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/quartzcomposer-dev/achim%40boinx.com
> 
> This email sent to [email protected]

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to