Javascript Sprite Animation

jersmi's picture

Posted is a working little animation using sprites, iterator and javascript. I want the animation to add the sprites (random size and color) without overlapping, and scroll as the screen fills.

  1. Regarding, for ex., sprites filling screen but not overlapping, in javascript (or otherwise, i guess), how can a relationship be set up between queue indices, so current index uses values from previous index (or indices) to determine x position, y position, width and height?

  2. Would it be better (faster) to have the random values sampled in js?

  3. How can I generate the scrolling, say after the screen fills? Best way? Sometimes I see the "dummy" patch time patch input in js -- what is this for? Am I off the mark for thinking of this re: scrolling in js?

Any help is appreciated.

Sorting a structure randomly

biro's picture

Hi Guys! this is my first post. So forgive me if the question could seem stupid

I have a directory scanner that retrieve me the list of movies in a specific folder. I'd like to "randomize the order" of that list, so every time i trig the structure, i can scramble the order.

I've tried with javascript with something like this PHP Code: function (__structure out) main (__structure input){ if(input !=null){ var result=new Object(); result.out=input.sort(function(){return (Math.round(Math.random())-0.5)); return result; } }
but it doesen't work....and i don't know neither how to debug it...

Any solution???


Random number sequence

tijnisfijn's picture


I made sort of a slideshow with a folder of picts. Now there playing in order. But i want them to play random from lets say 1 to 10 but showing every pict only once. than starting over and show all 10 in a different random sequence.

I can't seem to ficker it out. Can somebody help me? It can't be that hard?



Random-like values

.lov.'s picture


its a bit hard to tell what i really need, but i give a chance for it :) I have a structure, with some elements. I need to random access elements every 1 seconds, in a 4 sec loop. And, every random element need to be different inside the 4 sec loop. The structure is dynamic, so the multiplexer thing will not working.

For example, the structure has 10 members. 1st sec: 6 index 2nd sec: 2 index 3rd sec: 0 index 4th sec: 8 index

Loop ended, there is a new structure with 4 element. 1st sec: 3 index 2nd sec: 2 index 3rd sec: 0 index 4th sec: 1 index

. . .

I couldn't figure out is this possible with JS or with some 'spaghetti', or making a plugin for this is easier?