0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2024-12-22 13:43:03 -05:00

Layer Blur (#103)

* layer blur

* changeset
This commit is contained in:
Alex Sánchez 2024-05-13 13:23:19 +02:00 committed by GitHub
parent 2557cbdacc
commit c71eb8e736
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 25 additions and 3 deletions

View file

@ -0,0 +1,5 @@
---
"penpot-exporter": minor
---
Added support for layer blur

View file

@ -1,9 +1,10 @@
import { translateShadowEffects } from '@plugin/translators';
import { translateBlurEffects, translateShadowEffects } from '@plugin/translators';
import { ShapeAttributes } from '@ui/lib/types/shapes/shape';
export const transformEffects = (node: BlendMixin): Partial<ShapeAttributes> => {
return {
shadow: translateShadowEffects(node.effects)
shadow: translateShadowEffects(node.effects),
blur: translateBlurEffects(node.effects)
};
};

View file

@ -1,4 +1,5 @@
export * from './translateBlendMode';
export * from './translateBlurEffects';
export * from './translateFills';
export * from './translateShadowEffects';
export * from './translateStrokes';

View file

@ -0,0 +1,15 @@
import { Blur } from '@ui/lib/types/utils/blur';
export const translateBlurEffects = (effect: readonly Effect[]): Blur | undefined => {
const blur = effect.find(effect => effect.type === 'LAYER_BLUR');
if (!blur) {
return;
}
return {
type: 'layer-blur',
value: blur.radius,
hidden: !blur.visible
};
};

View file

@ -1,7 +1,7 @@
import { Uuid } from './uuid';
export type Blur = {
id: Uuid;
id?: Uuid;
type: 'layer-blur';
value: number;
hidden: boolean;