|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
<action name="getColor">
getRandomColor(0x); <!-- for layer -->
getRandomColor(#); <!-- for text -->
</action>
<action name="getRandomColor" type="Javascript" devices="html5"><![CDATA[
var letters = '0123456789ABCDEF';
var color = args[1];
for (var i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)];
}
krpano.set("randomColor", color);
]]></action>
|
Location: Netherlands
Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer
: https://pame.virtualtuur.com|
|
Source code |
1 2 |
mul(randomColor, random,999999); roundval(randomColor); |
999999 in order to get a value of 6 numbers
This post has been edited 5 times, last edit by "indexofrefraction" (Aug 1st 2017, 8:45pm)
|
|
Source code |
1 2 3 4 |
mul(randomColor, random, 16777215); roundval(randomColor); tohex(randomColor,'#',6); <!-- or tohex(randomColor,'0x',6); --> |
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 |
getRandomColor(color, '#'); trace(get(color)); getRandomColor(color, '0x'); trace(get(color)); <action name="getRandomColor"> mul(%1, random, 16777215); roundval(%1); tohex(%1,%2,6); </action> |
This post has been edited 10 times, last edit by "panomaster" (Aug 2nd 2017, 3:18am)
|
|
Source code |
1 2 3 4 |
<action name="getRandomColor"> calc(%1, random * 0xFFFFFF); tohex(%1, %2, 6); </action> |
)-