var1 = varOverTime( 1, 0.2, 5); // thread pass though varOverTime( start, time, NewValue ) { self thread func_varOverTime( start, time, NewValue ); } // logically var1 would be self. func_varOverTime( start, Time, NewValue ) { currentVal = start; // pos or neg if( start > NewValue ) { while( NewValue > currentVal && currentVal != NewValue ) { currentVal -= 0.01; self = currentVal; wait time; } } else { while( currentVal < NewValue ) { currentVal -= 0.01; self = currentVal; wait time; } } }