mirror of
https://github.com/penpot/penpot-exporter-figma-plugin.git
synced 2024-12-22 05:33:02 -05:00
parent
2557cbdacc
commit
c71eb8e736
5 changed files with 25 additions and 3 deletions
5
.changeset/gentle-kiwis-explain.md
Normal file
5
.changeset/gentle-kiwis-explain.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"penpot-exporter": minor
|
||||
---
|
||||
|
||||
Added support for layer blur
|
|
@ -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)
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
export * from './translateBlendMode';
|
||||
export * from './translateBlurEffects';
|
||||
export * from './translateFills';
|
||||
export * from './translateShadowEffects';
|
||||
export * from './translateStrokes';
|
||||
|
|
15
plugin-src/translators/translateBlurEffects.ts
Normal file
15
plugin-src/translators/translateBlurEffects.ts
Normal 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
|
||||
};
|
||||
};
|
|
@ -1,7 +1,7 @@
|
|||
import { Uuid } from './uuid';
|
||||
|
||||
export type Blur = {
|
||||
id: Uuid;
|
||||
id?: Uuid;
|
||||
type: 'layer-blur';
|
||||
value: number;
|
||||
hidden: boolean;
|
||||
|
|
Loading…
Reference in a new issue