Hi,
I want to scale the plugin of 50% of his size only in his width, for example, and 100% of his height.
when using percent values, then these values will be relative to the parent, or the screen (when there is no parent),
to scale a plugin to a relative values from its own source size, some code can be used,
the imagewidth/imageheight variables from a plugin or hotspot element are containing the source image size,
so they can be used to scale an image relative to it's own size,
see here the imagewidth/imageheight documentation:
http://krpano.com/docu/xml/#plugin.imagewidth
e.g. to set 'scalex' to 0.5 and 'scaley' to 1.0:
|
Source code
|
1
2
|
mul(width, imagewidth, 0.5);
mul(height, imageheight, 1.0);
|
or to animate/tween it:
|
Source code
|
1
2
3
4
|
mul(new_width, imagewidth, 0.5);
tween(width, get(new_width));
mul(new_height, imageheight, 1.0);
tween(height, get(new_height));
|
or use that code in an universal action (for calling from plugin/hotspot events):
|
Source code
|
1
2
3
4
5
6
7
|
<action name="scaleto">
<!-- 1. parameter = x scale, 2. parameter = y scale -->
mul(new_width, imagewidth, %1);
tween(width, get(new_width));
mul(new_height, imageheight, %2);
tween(height, get(new_height));
</action>
|
best regards,
Klaus