Hi,
right - the tweening works only on krpano variables, but the 'updatecall' and 'donecall' parameters can be also JS-functions.
Btw - the 'tweentype' parameter is a string, e.g. 'easeoutquad' - krpano.tweentypes.easeoutquad would be wrong.
Here a tween function that could be used to tween the property of an JS object:
|
Quellcode
|
1
2
3
4
5
6
7
8
9
10
11
|
function mytween(obj, propname, destvalue, time, tweentype, updatecall, donecall)
{
var varname = "mytweens." + propname;
krpano.set(varname, obj[propname]);
function update()
{
obj[propname] = krpano.get(varname);
if (updatecall != null) updatecall();
}
krpano.actions.tween(varname, destvalue, time, tweentype, donecall, update);
}
|
It first creates a krpano variable with the current value and then tweens that variable.
In the update function the object property will be set to the tweened value and optonally the updatecall callback function be called.
And when done the donecall callback function.
Best regards,
Klaus