There is an action PHP Random Include which I think that you might be able to use for this.
But your page would need to be a .php and I think that you would need to make your markup items into partials. Essentially your existing markup code saved with a file name of myfilename.inc
But then again - what do I know about PHP?
And besides Walter will have something in his armoury that is ready to fire!
If you hunt back a few days, I posted some JavaScript to select one of
N URLs at random when a button is pressed. If you have all of the
effects generated and uploaded, and all you have to do is insert one
of them by name, then you could put their names in the array in place
of the URLs, and change the observer from watching the button click to
watching the page load.
Since Protaculous already watches the page load, all you would need to
do is tell the script where it needs to go:
Things to edit to suit your page: effect_one, effect_two, etc – these
would become the names of your Hype exported animations, in a space-
separated list. Use as many of them as you like, only one will load.
yourTargetElement would be the name (in Freeway) of the box where you
are inserting the animation. If you’re doing a full-screen animation,
then the effect would be inserted into ‘PageDiv’. (capitalization is
critical here)
I haven’t tested this, and it’s possible that the script would be
inserted, but wouldn’t be evaluated (run as a program). I’m not sure
if that will work at all, and I don’t have time to experiment with it
today. I suspect that the PHP approach might be safer, because you are
simply creating an HTML file on the server, interpolating a random
element into the rest of the shell of the page, and then the browser
just does what it is supposed to do with a single file, rather than
using JavaScript to load more JavaScript and expecting it to run in
the same context. Might be a bridge too far in that case.
Walter
On Jul 26, 2011, at 10:37 PM, Julie Maxwell Allen wrote:
Ok. Cool.
I am unsure of php but would love to hear Walters thoughts and
magic on this also…
Sent from my iPhone
On Jul 26, 2011, at 9:12 PM, DeltaDave email@hidden wrote:
when you have time.
J
On Jul 27, 2011, at 10:21 AM, Walter Lee Davis wrote:
If you hunt back a few days, I posted some JavaScript to select one of N URLs at random when a button is pressed. If you have all of the effects generated and uploaded, and all you have to do is insert one of them by name, then you could put their names in the array in place of the URLs, and change the observer from watching the button click to watching the page load.
Since Protaculous already watches the page load, all you would need to do is tell the script where it needs to go:
Things to edit to suit your page: effect_one, effect_two, etc – these would become the names of your Hype exported animations, in a space-separated list. Use as many of them as you like, only one will load. yourTargetElement would be the name (in Freeway) of the box where you are inserting the animation. If you’re doing a full-screen animation, then the effect would be inserted into ‘PageDiv’. (capitalization is critical here)
I haven’t tested this, and it’s possible that the script would be inserted, but wouldn’t be evaluated (run as a program). I’m not sure if that will work at all, and I don’t have time to experiment with it today. I suspect that the PHP approach might be safer, because you are simply creating an HTML file on the server, interpolating a random element into the rest of the shell of the page, and then the browser just does what it is supposed to do with a single file, rather than using JavaScript to load more JavaScript and expecting it to run in the same context. Might be a bridge too far in that case.
Walter
On Jul 26, 2011, at 10:37 PM, Julie Maxwell Allen wrote:
Ok. Cool.
I am unsure of php but would love to hear Walters thoughts and magic on this also…
Sent from my iPhone
On Jul 26, 2011, at 9:12 PM, DeltaDave email@hidden wrote:
4 Make your markup items into partials. Essentially your existing markup code saved with a file name of myfilename.inc
Open the index.html file that Hype creates on export and copy out the section between the tags
Paste this into a plain text document and give it a meaningful name like animation1.inc
5 Upload these partials to the server - FTP probably best along with the Resources folder that Hype created for you. Put them at the same page level as the page on which these animations will appear.
6 Add the partials paths/names into the action interface ie animation1.inc, animation2.inc
4 Make your markup items into partials. Essentially your existing markup code saved with a file name of myfilename.inc
Open the index.html file that Hype creates on export and copy out the section between the tags
Paste this into a plain text document and give it a meaningful name like animation1.inc
5 Upload these partials to the server - FTP probably best along with the Resources folder that Hype created for you. Put them at the same page level as the page on which these animations will appear.
6 Add the partials paths/names into the action interface ie animation1.inc, animation2.inc