-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Labels
references参考/引用参考/引用
Description
PptxGenJS 的 这个合并支持了导出图形渐变(gitbrent/PptxGenJS#1295) ,但是仓库一直没有合并,尝试了下 发现效果还不错。
这是导出的效果
pptlist

wps

`
const opacity = el.opacity === undefined ? 1 : el.opacity
const fillColor = formatColor(el.fill)
let fill = {
color: fillColor.color,
transparency: (1 - fillColor.alpha * opacity) * 100,
}
if (el.gradient) {
const colors = el.gradient.colors
const stops = []
colors.map(itemColor => {
const currentColor = formatColor(itemColor.color)
stops.push({
position: itemColor.pos,
color: currentColor.color,
transparency: (1 - currentColor.alpha * opacity) * 100,
})
})
fill = {
type: 'linearGradient',
stops: stops,
angle: el.rotate,
scaled: 1,
rotWithShape: false,
tileRect: { t: 0, r: 0.5, b: 0.25, l: 1 },
flip: 'xy',
}
}
const options: pptxgen.ShapeProps = {
x: el.left / ratioPx2Inch.value,
y: el.top / ratioPx2Inch.value,
w: el.width / ratioPx2Inch.value,
h: el.height / ratioPx2Inch.value,
fill: fill,
points,
}`
Metadata
Metadata
Assignees
Labels
references参考/引用参考/引用