DirectX Media for Animation Programmer's Guide Previous
Previous
TOC
TOC
Index
Index

Appendix

Advanced Topic: Implementation of Reactivity Constructs


Advanced Topic: Implementation of Reactivity Constructs

The following constructs for reactivity are not primitive, and are implemented atop primitive Direct Animation for Java constructs. These implementations are quite straightforward and are provided here for illustrative purposes.

Cycler

This implementation presents a somewhat simplified version of Cycler that is not a subclass of Behavior, but rather has a getBvr() method.


public class Cycler extends Statics implements UntilNotifier {
    public Cycler(Behavior arr[], DXMEvent ev) {
        _arr = arr;
        _ev = ev;
        _count = 0;
        _len = arr.length;
        _bv = untilNotify(arr[0], ev, this);
    }
    public Behavior getBvr() { return _bv; }
    private Behavior notify(Object eData, Behavior prev, 
                            double eTime, BehaviorCtx ctx) {
        // move on to the next one, and set up again
        return untilNotify(arr[_count++ % _len], ev, this);
    }
}


© 1997 Microsoft Corporation. All rights reserved. Legal Notices.