Skip to content

Instantly share code, notes, and snippets.

@FlyInk13
Created November 19, 2017 12:15
Show Gist options
  • Save FlyInk13/c7a9fb0261be4c9c03646ff0f4def682 to your computer and use it in GitHub Desktop.
Save FlyInk13/c7a9fb0261be4c9c03646ff0f4def682 to your computer and use it in GitHub Desktop.
Генерирует тень со смещением по кругу
function genCircleShadow(r, items, limit){
var shadow = [];
limit = (360 / items) * limit;
for(var a = 0; a < limit; a += (360 / items)){
var ar = a / 180 * Math.PI,
x = ~~(Math.sin(ar) * r),
y = ~~(Math.cos(ar) * r),
c = "rgba(255,255,255," + (1 - a / limit).toFixed(2) + ")";
shadow.push(x + "px " + y + "px 0px 0px " + c);
}
return shadow.join(",\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment