我正在考虑使用 Google App Script 为 Figma 导出器创建一个 google 幻灯片。一开始,我首先想将在谷歌幻灯片中创建的形状路由到 figma。我将如何设置我的文件?而且我不知道如何设置 Google 和 Figma 之间的 Oauth api 通信,或者是否有可能。
我相信我可以从:
参考
Figma 参考
https://github.com/figma/plugin-samples/blob/master/react/src/code.ts
谷歌应用脚本参考
https://github.com/gsuitedevs/apps-script-samples/blob/master/slides/style/style.gs#L30
获取 Figma 形状
var file=projectid.key()
var=figma rectangle= file()
await figma.loadFontAsync({ family: "Roboto", style: "Regular" })
name;
var figmaShape = {
figma.ui.onmessage = msg => {
if (msg.type === 'create-rectangles') {
const nodes = []
for (let i = 0; i < msg.count; i++) {
const rect = figma.createRectangle()
rect.x = i * 150
rect.fills = [{type: 'SOLID', color: {r: 1, g: 0.5, b: 0}}]
figma.currentPage.appendChild(rect)
nodes.push(rect)
}
figma.currentPage.selection = nodes
figma.viewport.scrollAndZoomIntoView(nodes)
}
figma.closePlugin()
}
};
获取 Google Docs 文件形状
var powerpointfile = driveApp.getFileById = ("### Slide file ID ###")
function powerPointShape = () {
var slide = SlidesApp.getActivePresentation().getSlides()[0];
var shape = slide.insertShape(SlidesApp.ShapeType.TEXT_BOX, 100, 200, 300,
getObjectId.element(SHAPE);
};
创建新的 Figma 文件#
file.getSlides.shape = (powerPointShape, ) => {
this.powerPointShape.getRigh()=this.figmaShape(rect.x);
this.powerPointShape.getleft()=this.figmaShape(rect.y);
}
但是从那里我还想从谷歌应用脚本获取文件 ID 到 Figma 文件吗?
看了之后:https://github.com/alyssaxuu/figma-to-google-slides/blob/master/Chrome%20Extension/background.js我想知道我是否需要创建一个 chrome 扩展或一个谷歌幻灯片插件.