Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function onGLC(glc) {
- glc.loop();
- // glc.size(400, 400);
- glc.setDuration(.5);
- // glc.setFPS(20);
- glc.setMode("single");
- glc.setEasing(false);
- // glc.setMaxColors(256);
- glc.styles.shadowColor = "rgba(0,0,0,0.4)";
- glc.styles.shadowOffsetX = 5;
- glc.styles.shadowOffsetY = 5;
- glc.styles.shadowBlur = 10;
- var list = glc.renderList,
- width = glc.w,
- height = glc.h,
- color = glc.color;
- var ratio = 0.18, toothDepth = 9,
- radius1 = 50, x1 = 50, y1 = 100,
- radius2 = 70, x2 = x1+radius1+radius2-toothDepth,
- radius3 = 40, x3 = x2+radius2+radius3-toothDepth,
- radius4 = 35, y4 = y1+radius3+radius4-toothDepth,
- radius5 = 90, x5 = x3+50, y5 = y4 + 105,
- radius6 = 45, x6 = x5-radius6-radius5+toothDepth,
- radius7 = 75, x7 = x6-radius7-radius6+toothDepth,
- radius8 = 35, x8 = x7,y8 = y5-radius8-radius7+toothDepth+1;
- var addNewGear = function(rad, posx, posy, rot1, clockwise) {
- var numTeeth = Math.floor(rad*ratio),
- rot2 = 360 / numTeeth;
- if(!clockwise) {
- rot2 *= -1;
- }
- rot2 += rot1;
- list.addGear({
- x: posx,
- y: posy,
- radius: rad,
- teeth: numTeeth,
- rotation: [rot1,rot2],
- fill:true,
- fillStyle: color.randomRGB()
- })
- list.addCircle({
- x: posx,
- y: posy,
- fill: "black",
- stroke: false,
- radius: 10
- })
- }
- addNewGear(radius1,x1,y1,0,true);
- addNewGear(radius2,x2,y1,3,false);
- addNewGear(radius3,x3,y1,27,true);
- addNewGear(radius4,x3,y4,-6,false);
- addNewGear(radius5,x5,y5,5,true);
- addNewGear(radius6,x6,y5,-4,false);
- addNewGear(radius7,x7,y5,6,true);
- addNewGear(radius8,x8,y8,6,false);
- }
Advertisement
Add Comment
Please, Sign In to add comment