Skip to content

Instantly share code, notes, and snippets.

@rayrayzayzay
Created January 5, 2023 20:57
Show Gist options
  • Save rayrayzayzay/797c99b7c336befd0058c754e96832ba to your computer and use it in GitHub Desktop.
Save rayrayzayzay/797c99b7c336befd0058c754e96832ba to your computer and use it in GitHub Desktop.
function getDropShadowOffset(rotation: number): Vec2 {
const angle = degreesToRadians(rotation + 45);
return [Math.sin(angle), Math.cos(angle)];
}
function getDropShadowFilterWithOffset
([offsetX, offsetY]: Vec2): string {
return `<filter id='shadow'
color-interpolation-filters="sRGB">
<feDropShadow dx="${offsetX}"
dy="${offsetY}" stdDeviation="1"
flood-opacity="0.2"/>
</filter>`;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment