You are not logged in.

1

Thursday, October 13th 2016, 11:01am

math with more than 3 values?

hi

i need to add some values together and hope there is an easier way than making a tree of add commands until you get the final result!

can you please give me a hint?

thanks
sven

This post has been edited 1 times, last edit by "sr_raumgleiter" (Oct 13th 2016, 5:15pm)


2

Thursday, October 13th 2016, 11:41am

Hi,

use the calc() action:
http://krpano.com/docu/actions/#calc

E.g

Source code

1
calc(result, a + b + c);
or:

Source code

1
set(result, calc(a + b + c));


Best regards,
Klaus

3

Thursday, October 13th 2016, 1:27pm

hi klaus

thanks for that. i already tried to use calc several times, but most of the time i do not get the right syntax to get it working.

-> i would like to use it to add 2 pixelheights and an offset value
what i tried is this:

Source code

1
set(layer[1].height, calc(get(layer[2].pixelheight) + get(layer[3].pixelheight + 10));



or is there an easier way to set the height of a container to the total height of all the content?

thanks
sven

4

Thursday, October 13th 2016, 3:43pm

get() is not needed in calc()
--->

Source code

1
set(layer[1].height, calc(layer[2].pixelheight + layer[3].pixelheight + 10));


Source code

1
calc(layer[1].height, layer[2].pixelheight + layer[3].pixelheight + 10);


generally you can also work with % values,
so maybe height = 100% would work, but there you need to test.

mit gruess! ;)

5

Thursday, October 13th 2016, 4:38pm

perfekt, danke!

works fine now! the question about total height was for a surrounding container. if i would use 100% there, it would check the size of it's parent object.
but i do want to now the total size of all the child elements together. i think the % won't work there...

sven