JavaScript

Topic: Anything JavaScript, ECMAScript including Node, React, ...
Apr 20, 2017 09:28
@Cerbrus thanks!
Apr 20, 2017 09:17
Filling the width would be first prize though
Apr 20, 2017 09:17
Yes. The width doesn't necessarily need to be filled but the blocks must not exceed the canvas lenght
Apr 20, 2017 09:13
Sorry, my brain is fried from this problem.
Apr 20, 2017 09:13
@Cerbrus @KarelG So I would generate a random number between the length of the canvas and the sum of the width of all blocks already placed?
Apr 20, 2017 09:06
@Cerbrus I just want to create x number of blocks with random widths and they must stack next to each other not passing the width of the canvas
Apr 20, 2017 09:05
@KarelG thanks
Apr 20, 2017 09:01
@Cerbrus I have managed to generate random heights (not exceeding the canvas height), but i am struggling to do so for the width of the block. Any help would be greatly appreciated. - jsfiddle.net/n5kgbe3g/5
Apr 20, 2017 08:21
Thanks @Cerbrus
Apr 20, 2017 08:15
Yeah i need the widths of the blocks to be random...
Apr 20, 2017 08:14
So say I want to generate 5 blocks. I need 5 blocks (with random widths) to fill the width of the canvas. I.e not go over the canvas
Apr 20, 2017 08:12
jsfiddle.net/n5kgbe3g/1 - I need to generate a number (by var number) of blocks and give them a random width and then fit them to 100% width of the canvas
Apr 20, 2017 08:10
Hey guys - any JavaScript + HTML5 Canvas ninjas on here? Please give me a shout if you can help me generate random width blocks and fill them to the width of the canvas! Thanjs