Example #1
0
 RotateModifier.prototype.checkAndUpdate = function(scrollPosition, delta) {
     if ((this.scrollStart === undefined ||
         scrollPosition >= this.scrollStart) &&
         (this.scrollStop === undefined ||
         scrollPosition <= this.scrollStop)) {
         // Inside scroll range
         this.rotateState = 'active';
         this.theta = UnitConverter.degreesToRadians((scrollPosition - this.scrollStart) * this.scale);
     } else if (((scrollPosition - delta) <= this.scrollStop) &&
                (scrollPosition > this.scrollStop)) {
         // Passing out of scroll range.
         this.rotateState = 'upper';
         this.theta = UnitConverter.degreesToRadians(this.scrollRange * this.scale);
     } else if (((scrollPosition - delta) >= this.scrollStart) &&
                (scrollPosition < this.scrollStart)) {
         // Passing out of scroll range.
         this.rotateState = 'lower';
         this.theta = 0;
     } else {
         // out of range
         this.rotateState = 'inactive';
     }
 };
    function RotateToModifier(options) {
        this.options = Object.create(RotateToModifier.DEFAULT_OPTIONS);
        this._optionsManager = new OptionsManager(this.options);
        if (options) this.setOptions(options);

        this.actor = this.options.actor;
        this.scrollStart  = this.options.scrollStart;
        this.scrollStop = this.options.scrollStop;
        this.scrollRange = this.options.scrollStop - this.options.scrollStart;
        this.curveFn = this.options.curveFn;
        this.theta = 0;
        this.startTheta = 0;
        this.stopTheta = UnitConverter.degreesToRadians(this.options.angleInDegrees);
        this.rotateState = 'inactive';

        _setupAxis.call(this, this.options.axis);
        _makeModifier.call(this);
        Modifier.call(this, this.modifier);
    }