• With width and height you can set absolute value or relative to screen, right?
    I want to scale the plugin of 50% of his size only in his width, for example, and 100% of his height.

  • 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:
    https://krpano.com/docu/xml/#plugin.imagewidth

    e.g. to set 'scalex' to 0.5 and 'scaley' to 1.0:

    Code
    mul(width, imagewidth, 0.5);
    mul(height, imageheight, 1.0);

    or to animate/tween it:

    Code
    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):

    Code
    <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

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!