Hello Dan,
I am talking on the similar lines, currently I am also doing pretty much the same way you do, but its really dirty way, and i am still learning the whole coding thing.
currently, I am using a string.contains to find keywords, then using a switch statement I am calculating and substituting the keyswords with calculated values
this works but is surely not the best way to do it. also I want to be able to write keywords for functions for example
/*
Key Object which represents each keyframe in property
*/
function Key ( args )
{
}
//This functions takes care of setting the key and assigning the values
Key.prototype.setAt = function ( property, time )
{
var _layer = property.propertyGroup( property.propertyDepth );
var _comp = _layer.containingComp;
if ( this.ValueType == undefined || this.ValueType !== property.propertyValueType )
return 0;
if ( this.nTimeOffset == undefined )
return 0;
var keyIndex = property.addKey ( time + this.nTimeOffset );
if ( this.nValue !== undefined )
property.setValueAtKey ( keyIndex, this.nValue );
if ( this.Expression !== undefined || this.Expression !== "" )
{
var val = eval( this.Expression );
if ( val !== undefined )
property.setValueAtKey ( keyIndex, val );
}
}
//helper function which can be called from the script to get the value of certain key frame
function _KeyValueAt ( index )
{
}
Sample Expression :
"_keyValueAt ( -2 );"
this expression will be evaluated in the setAt function,
this works but I want the function to know the 3 variables
1. property
2. _layer
3. _comp
so that it can use these to calculate the values
hope I was right to the point this time