Hi,
yes, this one action is a more trickier one

.
One reason was it was designed to be more universally usable, e.g. for hotspot and layer elements, and to correct slightly wrong inputs.
The 'registerattribute' function is from the plugin-api, but it's also callable and usable from xml:
http://krpano.com/docu/plugininterface/#registerattribute
It basically directly adds an new attribute to the current 'caller' object (which can be either a hotspot or a layer). An other way would be using - set(layer[get(name)].attribute, value); - but there it would be necessary to differ between hotspots and layers.
The 'imagewidth', 'imageheight' and 'loaded' attributes are normal ones - see here in the documentation:
http://krpano.com/docu/xml/#hotspot.imagewidth
http://krpano.com/docu/xml/#hotspot.loaded
The 'onlastframe' event is a custom one from the 'do_crop_animation' action. The actions checks if at the given hotspot (or layer) an 'onlastframe' attribute is defined, and when yes, it calls it on the last frame of the animation. E.g. the 'explosion' hotspot changes it's location every time in this case.
That 'BOR' means 'bit-wise OR' - see here the expressions documentation:
http://krpano.com/docu/actions/#expressions
And using 'value BOR 0' is a trick to convert an number to an integer - that means removing the decimal places (like rounding down). Otherwise there could be eventuality a remainder when using (wrongly) an image size that is not fully dividable by the frame size.
Instead of:
|
Quellcode
|
1
|
registerattribute(xframes, calc((imagewidth / %1) BOR 0));
|
it would be also possible to write the code this way:
|
Quellcode
|
1
2
3
|
div(tmp, imagewidth, %1); // do the division
Math.floor(tmp); // round down to remove an potential remainder
registerattribute(xframes, get(tmp)); // register the attribute with that value
|
but that's not necessarily better

.
Best regards,
Klaus