-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Thomas Lowry
committed
May 3, 2020
1 parent
a7ec9d3
commit d3400ad
Showing
6 changed files
with
75 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,38 @@ | ||
figma.showUI(__html__,{width:232,height:208}),figma.ui.onmessage=function(e){if("create-shapes"===e.type){for(var a=[],i=0;i<e.count;i++){var g;(g="rectangle"===e.shape?figma.createRectangle():"triangle"===e.shape?figma.createPolygon():figma.createEllipse()).x=150*i,g.fills=[{type:"SOLID",color:{r:1,g:.5,b:0}}],figma.currentPage.appendChild(g),a.push(g)}figma.currentPage.selection=a,figma.viewport.scrollAndZoomIntoView(a)}figma.closePlugin()}; | ||
// This plugin will open a modal to prompt the user to enter a number, and | ||
// it will then create that many rectangles on the screen. | ||
// This file holds the main code for the plugins. It has access to the *document*. | ||
// You can access browser APIs in the <script> tag inside "ui.html" which has a | ||
// full browser enviroment (see documentation). | ||
// This shows the HTML page in "ui.html". | ||
figma.showUI(__html__, { width: 232, height: 208 }); | ||
// Calls to "parent.postMessage" from within the HTML page will trigger this | ||
// callback. The callback will be passed the "pluginMessage" property of the | ||
// posted message. | ||
figma.ui.onmessage = function (msg) { | ||
// One way of distinguishing between different types of messages sent from | ||
// your HTML page is to use an object with a "type" property like this. | ||
if (msg.type === 'create-shapes') { | ||
var nodes = []; | ||
for (var i = 0; i < msg.count; i++) { | ||
var shape; | ||
if (msg.shape === 'rectangle') { | ||
shape = figma.createRectangle(); | ||
} | ||
else if (msg.shape === 'triangle') { | ||
shape = figma.createPolygon(); | ||
} | ||
else { | ||
shape = figma.createEllipse(); | ||
} | ||
shape.x = i * 150; | ||
shape.fills = [{ type: 'SOLID', color: { r: 1, g: 0.5, b: 0 } }]; | ||
figma.currentPage.appendChild(shape); | ||
nodes.push(shape); | ||
} | ||
figma.currentPage.selection = nodes; | ||
figma.viewport.scrollAndZoomIntoView(nodes); | ||
} | ||
// Make sure to close the plugin when you're done. Otherwise the plugin will | ||
// keep running, which shows the cancel button at the bottom of the screen. | ||
figma.closePlugin(); | ||
}; |
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
function helloThere() { | ||
console.log('hello there'); | ||
} | ||
helloThere(); | ||
|
||
helloThere(); | ||
selectMenu.init(); |