You are not logged in.

1

Monday, May 1st 2017, 10:46pm

Generate random coordinates

I followed a sample for generating random coordinates for animated PNG's, but currently, the random generation only occurs in one area of the frame, I'd like for it to occur in the entire 360º environment. How might I do this? Here is the piece of code I'm currently using:

Source code

1
<hotspot name="hs4" url="red.png"  onloaded="do_crop_animation(5,5, 5)"  alpha="0.5"  ath="calc:random*90- 45" atv="calc:random*60 - 30"  distorted="true" zoom="true" enabled="false" onlastframe="calc(ath, random*90-45);calc(atv, random*60-30);"/>

Tuur

Sage

Posts: 3,839

Location: Netherlands

Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Send private message

3

Thursday, May 4th 2017, 10:20pm

Hi,

Quoted

the random generation only occurs in one area of the frame, I'd like for it to occur in the entire 360º environment

Instead of:

Source code

1
ath="calc:random*90 - 45" atv="calc:random*60 - 30"

use this:

Source code

1
ath="calc:random*360 - 180" atv="calc:random*180 - 90"


This generates random values in the range -180 to +180 for ath and -90 to +90 for atv.

Best regards,
Klaus