Hello @mr-dang,
I'm trying to implement the revered "full screen randomness" of a Gallery with TemplateSize 0, and I need your insights.
So far I have:
ClearCollect( colAllMojis, { emoji: emojiList.url } )
ClearCollect( colDisplayEmojis, { emoji: First(colAllMojis).emoji.url, y: Rand(), x: Rand() } )
ThisItem.emoji.url
But this is not working for me! I'm looking to click the button and see 1500 emojis on the screen in random places with each click (similar to your awesome Baby Smash-like text example).
If I set the image control to :
First( ThisItem.emoji).url
...I can get a single emoji to jump around the screen, but I WANT ALL 1500 ! :().
Can you guide?
Solved! Go to Solution.
I think what you may need to do is change where you do the ForAll:
//Collect all emojis from Sharepoint column and apply a random x and y coordinate// Clear(AllMojis); ForAll(emojiList, Collect( AllMojis, { link: url, x: RoundUp(Rand() * 1266 , 0 ), y: RoundUp(Rand() * 668 , 0 ) } ) )
This means, "For each of the emojis in your emojiList, collect a record in a collection called AllMojis. Make it include the link to the respective URL in the emojiList, and give it a random number in the x and y column."
I rounded up the x and y to whole numbers.
Ah, I know what it is. Rand() generates a random number between 0 and 1 (0 is inclusive, but not 1). You need to multiply it by the range you want to get the x and y coordinates you want.
So in the x direction, you'd multiply by Screen.Width, and in the y direction, you'd multiply by Screen.Height.
Let me know if that's it.
Brian
Here's a sample app:
Wow... ~ 01:13 into Space Invaders Episode 1... incredible!
I'm close. Implemented your idea of screen size (minus size of emoji).
//Collect all emojis from Sharepoint column and apply a random x and y coordinate// ClearCollect( AllMojis, { link: emojiList.url, x: ForAll(emojiList.url, Rand() * 1266), y: ForAll(emojiList.url, Rand() * 668) } )
First(AllMojis.link).link.url
url
ClearCollect( colEmojis, { //image: ForAll(AllMojis,link),// x: ForAll(AllMojis.link, Rand() * 1266), y: ForAll(AllMojis.link, Rand() * 668) } )
First(First(colEmojis.x).x).Value
I think what you may need to do is change where you do the ForAll:
//Collect all emojis from Sharepoint column and apply a random x and y coordinate// Clear(AllMojis); ForAll(emojiList, Collect( AllMojis, { link: url, x: RoundUp(Rand() * 1266 , 0 ), y: RoundUp(Rand() * 668 , 0 ) } ) )
This means, "For each of the emojis in your emojiList, collect a record in a collection called AllMojis. Make it include the link to the respective URL in the emojiList, and give it a random number in the x and y column."
I rounded up the x and y to whole numbers.
User | Count |
---|---|
195 | |
123 | |
86 | |
48 | |
40 |
User | Count |
---|---|
281 | |
165 | |
138 | |
80 | |
76 |