Page 1 of 1

multi-image background

Posted: Sat Mar 31, 2012 2:25 pm
by Jgc

A way to have a random background image appear at the start of the app would be nice.

So the user starts the app, imageA is set for the background....A few hours later the app is run again by the user and imageB is set for the background. And so on. I imagine, it would make best sense if the background be selected from an multi-image selection dialogue box/window.


multi-image background

Posted: Sun Apr 01, 2012 12:29 am
by maxkatz

You can do it today. Have a number of background images and randomly pick one (or any other method) when the app loads.

https://getsatisfaction.com/tiggzi/to...


multi-image background

Posted: Fri Jan 09, 2015 6:59 pm
by Mike6580064

Max,

Can you please provide these details again as the link above no longer works. I have an image component and would like its contents to be randomized from a handful of images. Is this possible?

Thanks,
Mike


multi-image background

Posted: Sat Jan 10, 2015 7:43 am
by Alena Prykhodko

Hi Mike,

Here is the thread https://getsatisfaction.com/apperyio/...


multi-image background

Posted: Mon Jan 12, 2015 1:41 pm
by Mike6580064

Alena,

I don't see anything there about randomized images.


multi-image background

Posted: Tue Jan 13, 2015 1:39 am
by Yurii Orishchuk

Hi Mike,

To get random image - you need to get random number before.

Here is a code to get random number:

pre

var randomMin = 100;
var randomMax = 300;

var random = Math.random() * (randomMax - randomMin);

var limitedRandom = Math.round(random + randomMin);

console.log("limitedRandom = " + limitedRandom);

/pre

Then when you get random image with certain limits - you can convert it into random text(from array).

So code to get random text from array is:

pre

var textArray = [
"firstText",
"secondText",
"thirdText",
"forthText",
"fivesText"
];

var randomMin = 0;
var randomMax = textArray.length;

var random = Math.random() * (randomMax - randomMin);

var limitedRandom = Math.round(random + randomMin);

var randomText = textArray[limitedRandom];

console.log("randomText = " + randomText);

/pre

Now you can put into textArray needed urls and you will get random url.

Regards.