Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function onGLC(glc) {
- glc.loop();
- glc.size(500, 500);
- glc.setDuration(4);
- glc.setMode('single');
- glc.setEasing(false);
- var list = glc.renderList,
- width = glc.w,
- height = glc.h,
- color = glc.color;
- glc.styles.backgroundColor = "rgb(21, 21, 21)";
- // your code goes here:
- var mag = width/12;
- for(var n=0; n<4; n++){
- wave(width/4 + 2*n*mag, mag, n*Math.PI/2);
- }
- function wave (ypos, mag, phase){
- for(var i=50; i<=width-50; i+=10){
- if(parseInt((i-50)/10)%2 == 1){
- glc.styles.fillStyle = "#ff0000";
- } else {
- glc.styles.fillStyle = "#0000ff";
- }
- list.addCircle({
- index: i,
- x: function(t){
- var offset = t*3*Math.PI;
- return ypos + mag*Math.sin(Math.PI*this.index/300 + offset + phase);
- },
- y: i,
- radius: 3,
- fillStyle: (((i-50)/10)%2 == 0)?"#cc0000":"#fff"
- });
- list.addCircle({
- index: i,
- x: function(t){
- var offset = t*3*Math.PI;
- return ypos + mag*Math.sin(-Math.PI*this.index/300 - offset - phase);
- },
- y: i,
- radius: 3,
- fillStyle: (((i-50)/10)%2 == 0)?"#cc0000":"#fff"
- });
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement