Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function onGLC(glc) {
- glc.loop();
- // glc.playOnce();
- glc.size(540, 540);
- glc.setDuration(2.5);
- glc.setFPS(40);
- glc.setMode("single");
- glc.setEasing(false);
- var list = glc.renderList,
- width = glc.w,
- height = glc.h;
- // your code goes here:
- var num = 100;
- var yPos, sz, p, dir;
- var even = true;
- var col1, col2;
- for (var i=0; i<num; i++){
- if (even) {
- dir =((Math.random()*1)>.5) ? 1 : -1;
- if ((Math.random()*1)>.9) {
- col1 = "rgba(255,0,0,1)";
- col2 = col1;
- } else {
- col1 = "rgba(255,255,255,.25)";
- col2 = "rgba(0,0,0,1)"
- }
- //col2 = ((Math.random()*1)>.9) ? "rgba(255,0,0,1)": "rgba(0,0,0,1)";
- yPos = Math.random()*height;
- sz = 20+Math.random()*20;
- p = Math.floor(Math.random()*Math.PI*2);
- }
- list.addPoly({
- x: [width/num*i,width/num*(i+1)],
- y: even ? [yPos+height+sz,yPos] : [yPos,yPos-height-sz],
- sides: 6,
- radius: even ? [sz, sz*2] : [sz*2,sz],
- rotation: [0,180*dir],
- stroke: true,
- lineWidth: 3,
- strokeStyle: "white",
- fillStyle: even ? [col1,col2 ]:[col2, col1] ,
- phase: p
- });
- even =! even;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement