• Hi,

    is there a way to tween composite strings like "x|y|z" ? I have a depthmap (*.obj) and I would like to change its origin (all 3 coordinates at once) using the tween. E.g. from "0|0|0" to "2|-3|1" Something like this ... which obviously doesn't work. Thanks

    Code
    tween(image.depthmap.origin, 'x|y|z', 2);
  • Hi,

    current the only way would be using txtsplit to split the value into separate variables, then tween them, and in the tween update-callback join the variables again using txtjoin:

    Code
    txtsplit(image.depthmap.origin, '|', ox,oy,oz);
    tween(ox|oy|oz, '1|2|3', 0.5, default, null, txtjoin(image.depthmap.origin, '|', ox,oy,oz));


    But basically that's a good point - I have added now built-in support for tweening such variables.
    That means from version 1.22 on it will be possible to tween variables that contain multiple values (separated either by '|' or ',').

    Best regards,
    Klaus

  • Code
    txtsplit(image.depthmap.origin, '|', ox,oy,oz);
    tween(ox|oy|oz, '1|2|3', 0.5, default, null, txtjoin(image.depthmap.origin, '|', ox,oy,oz));

    Hi Klaus,

    I would like to apply the same code on cropping the image hotspot using the tween action. Something like:


    Code
    <hotspot name="myimage" type="image" url="image.png" crop="0|0|50|300" edge="bottom" ... />
    
    <action name="tweencropmyimage" >
    	txtsplit(hotspot[myimage].crop, '|', hotspot[myimage].x-position|hotspot[myimage].y-position|hotspot[myimage].width|hotspot[myimage].height);
    	tween(hotspot[myimage].x-position|hotspot[myimage].y-position|hotspot[myimage].width|hotspot[myimage].height, '0|0|50|150', 3, linear, null, txtjoin(hotspot[myimage].crop, '|', hotspot[myimage].x-position|hotspot[myimage].y-position|hotspot[myimage].width|hotspot[myimage].height));
    </action>	


    In this example, my hotspot image resolution is 50 x 300 px (width x height) and I would like to smoothly crop it by tween action to 50 x 150 px.

    My gut feeling is telling me that the krpano variables hidden in crop="0|0|50|300" are not "x-position|y-position|width|height"

    Could you please help me to identify the correct variables used in the image crop="?|?|?|?"

    Thanks

  • this is not how to use txtsplit(), see here https://krpano.com/docu/actions/#txtsplit

    hotspot[myimage].x/y-position doesnt exist and x/y/width/height are not the same als the values in crop.

    (in short: the individual crop values are not exposed as attributes on hotspots)

    to my understanding tweening a crop is supported

  • Hi, the splitting would work, but you need to use custom variables, reusing the existing width/height variable will not work (or cause problems). And variables with a '-' in their name are also problematic (because it could get parsed as minus/subtraction expression).

    Here your code slightly modified - it creates and uses custom cropx,cropy,cropw,croph variables:

    Code
    txtsplit(hotspot[myimage].crop, '|', hotspot[myimage].cropx|hotspot[myimage].cropy|hotspot[myimage].cropw|hotspot[myimage].croph);
    tween(hotspot[myimage].cropx|hotspot[myimage].cropy|hotspot[myimage].cropw|hotspot[myimage].croph, '0|0|50|150', 3, linear, null, txtjoin(hotspot[myimage].crop, '|', hotspot[myimage].cropx|hotspot[myimage].cropy|hotspot[myimage].cropw|hotspot[myimage].croph));


    And as written above - with version 1.22 tweening such variables like crop will be directly possible *wink*.

Participate now!

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