dist/famous-flex.js
function _setPropertyValue(prop, propName, endState, defaultValue, immediate, isTranslate) {

        // Get property
        prop = prop || this._properties[propName];

        // Update the property
        if (prop && prop.init) {
            prop.invalidated = true;
            var value = defaultValue;
            if (endState !== undefined) {
                value = endState;
            }
            else if (this._removing) {
                value = prop.particle.getPosition();
            }
            //if (isTranslate && (this._lockDirection !== undefined) && (this._lockTransitionable.get() === 1)) {
            //    immediate = true; // this is a bit dirty, it should check !_lockDirection for non changes as well before setting immediate to true
            //}
            // set new end state (the quick way)
            prop.endState.x = value[0];
            prop.endState.y = (value.length > 1) ? value[1] : 0;
            prop.endState.z = (value.length > 2) ? value[2] : 0;
            if (immediate) {
                // set current state (the quick way)
                prop.curState.x = prop.endState.x;
                prop.curState.y = prop.endState.y;
                prop.curState.z = prop.endState.z;
                // reset velocity (the quick way)
                prop.velocity.x = 0;
                prop.velocity.y = 0;
                prop.velocity.z = 0;
            }
            else if ((prop.endState.x !== prop.curState.x) ||
                     (prop.endState.y !== prop.curState.y) ||
                     (prop.endState.z !== prop.curState.z)) {
                this._pe.wake();
            }
            return;
        }
        else {

            // Create property if neccesary
            var wasSleeping = this._pe.isSleeping();
            if (!prop) {
                prop = {
                    particle: new Particle({
                        position: (this._initial || immediate) ? endState : defaultValue
                    }),
                    endState: new Vector(endState)
                };
                prop.curState = prop.particle.position;
                prop.velocity = prop.particle.velocity;
                prop.force = new Spring(this.options.spring);
                prop.force.setOptions({
                    anchor: prop.endState
                });
                this._pe.addBody(prop.particle);
                prop.forceId = this._pe.attach(prop.force, prop.particle);
                this._properties[propName] = prop;
            }
            else {
                prop.particle.setPosition((this._initial || immediate) ? endState : defaultValue);
                prop.endState.set(endState);
            }
            if (!this._initial && !immediate) {
                this._pe.wake();
            }
            else if (wasSleeping) {
                this._pe.sleep(); // nothing has changed, put back to sleep
            }
            if (this.options.properties[propName] && this.options.properties[propName].length) {
                prop.enabled = this.options.properties[propName];
            }
            else {
                prop.enabled = [
                  this.options.properties[propName],
                  this.options.properties[propName],
                  this.options.properties[propName]
                ];
            }
            prop.init = true;
            prop.invalidated = true;
        }
    }
function _setPropertyValue(prop, propName, endState, defaultValue, immediate, isTranslate) {

        // Get property
        prop = prop || this._properties[propName];

        // Update the property
        if (prop && prop.init) {
            prop.invalidated = true;
            var value = defaultValue;
            if (endState !== undefined) {
                value = endState;
            }
            else if (this._removing) {
                value = prop.particle.getPosition();
            }
            //if (isTranslate && (this._lockDirection !== undefined) && (this._lockTransitionable.get() === 1)) {
            //    immediate = true; // this is a bit dirty, it should check !_lockDirection for non changes as well before setting immediate to true
            //}
            // set new end state (the quick way)
            prop.endState.x = value[0];
            prop.endState.y = (value.length > 1) ? value[1] : 0;
            prop.endState.z = (value.length > 2) ? value[2] : 0;
            if (immediate) {
                // set current state (the quick way)
                prop.curState.x = prop.endState.x;
                prop.curState.y = prop.endState.y;
                prop.curState.z = prop.endState.z;
                // reset velocity (the quick way)
                prop.velocity.x = 0;
                prop.velocity.y = 0;
                prop.velocity.z = 0;
            }
            else if ((prop.endState.x !== prop.curState.x) ||
                     (prop.endState.y !== prop.curState.y) ||
                     (prop.endState.z !== prop.curState.z)) {
                this._pe.wake();
            }
            return;
        }
        else {

            // Create property if neccesary
            var wasSleeping = this._pe.isSleeping();
            if (!prop) {
                prop = {
                    particle: new Particle({
                        position: (this._initial || immediate) ? endState : defaultValue
                    }),
                    endState: new Vector(endState)
                };
                prop.curState = prop.particle.position;
                prop.velocity = prop.particle.velocity;
                prop.force = new Spring(this.options.spring);
                prop.force.setOptions({
                    anchor: prop.endState
                });
                this._pe.addBody(prop.particle);
                prop.forceId = this._pe.attach(prop.force, prop.particle);
                this._properties[propName] = prop;
            }
            else {
                prop.particle.setPosition((this._initial || immediate) ? endState : defaultValue);
                prop.endState.set(endState);
            }
            if (!this._initial && !immediate) {
                this._pe.wake();
            }
            else if (wasSleeping) {
                this._pe.sleep(); // nothing has changed, put back to sleep
            }
            if (this.options.properties[propName] && this.options.properties[propName].length) {
                prop.enabled = this.options.properties[propName];
            }
            else {
                prop.enabled = [
                  this.options.properties[propName],
                  this.options.properties[propName],
                  this.options.properties[propName]
                ];
            }
            prop.init = true;
            prop.invalidated = true;
        }
    }
function _setPropertyValue ( prop , propName , endState , defaultValue , immediate , isTranslate ) { // Get property prop = prop || this . _properties [ propName ] ; // Update the property if ( prop && prop . init ) { prop . invalidated = true ; var value = defaultValue ; if ( endState !== undefined ) { value = endState ; } else if ( this . _removing ) { value = prop . particle . getPosition ( ) ; } //if (isTranslate && (this._lockDirection !== undefined) && (this._lockTransitionable.get() === 1)) { //    immediate = true; // this is a bit dirty, it should check !_lockDirection for non changes as well before setting immediate to true //} // set new end state (the quick way) prop . endState . x = value [ 0 ] ; prop . endState . y = ( value . length > 1 ) ? value [ 1 ] : 0 ; prop . endState . z = ( value . length > 2 ) ? value [ 2 ] : 0 ; if ( immediate ) { // set current state (the quick way) prop . curState . x = prop . endState . x ; prop . curState . y = prop . endState . y ; prop . curState . z = prop . endState . z ; // reset velocity (the quick way) prop . velocity . x = 0 ; prop . velocity . y = 0 ; prop . velocity . z = 0 ; } else if ( ( prop . endState . x !== prop . curState . x ) || ( prop . endState . y !== prop . curState . y ) || ( prop . endState . z !== prop . curState . z ) ) { this . _pe . wake ( ) ; } return ; } else { // Create property if neccesary var wasSleeping = this . _pe . isSleeping ( ) ; if ( ! prop ) { prop = { particle : new Particle ( { position : ( this . _initial || immediate ) ? endState : defaultValue } ) , endState : new Vector ( endState ) } ; prop . curState = prop . particle . position ; prop . velocity = prop . particle . velocity ; prop . force = new Spring ( this . options . spring ) ; prop . force . setOptions ( { anchor : prop . endState } ) ; this . _pe . addBody ( prop . particle ) ; prop . forceId = this . _pe . attach ( prop . force , prop . particle ) ; this . _properties [ propName ] = prop ; } else { prop . particle . setPosition ( ( this . _initial || immediate ) ? endState : defaultValue ) ; prop . endState . set ( endState ) ; } if ( ! this . _initial && ! immediate ) { this . _pe . wake ( ) ; } else if ( wasSleeping ) { this . _pe . sleep ( ) ; // nothing has changed, put back to sleep } if ( this . options . properties [ propName ] && this . options . properties [ propName ] . length ) { prop . enabled = this . options . properties [ propName ] ; } else { prop . enabled = [ this . options . properties [ propName ] , this . options . properties [ propName ] , this . options . properties [ propName ] ] ; } prop . init = true ; prop . invalidated = true ; } }
Helper function to set the property of a node (e.g. opacity, translate, etc..)
Helper function to set the property of a node ( e . g . opacity translate etc .. )