Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Javascript polygon editor for vector game development.www.vectoralchemy.com

License

NotificationsYou must be signed in to change notification settings

epmoyer/polygondraw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Polygondraw is a browser based polygon editor originally written by Max Wihlborg to support his excellent Javascript Asteroids tutorial. I started using it extensively to develop my own vector games (seevectoralchemy.com), so I ended up fleshing out the feature set.

ButtonModeHotkeyDescription
ArrowsMoveM orClick on (or near) a vertex to pick it up. Click again to drop it.
PencilLineLClick to add a vertices (i.e. draw a new line segment).
PlusAddAClick along (or near) an existing line segment to add a new vertex along it.
ScissorsCutCClick on (or near) vertices to remove them.
CrosshairChange OriginOClick to specify a new origin.
EyeToggle VisibilityVToggle the visibility of a line segment.
AnchorToggle Grid SnapSToggle snapping to the grid.
Circular Left ArrowUndoUUndo
Circular Right ArrowRedoRRedo
TrashClear(N/A)Clear all vertices.
BrushesColor(N/A)Set a color
CopyCopy(N/A)Open a new web page with the current vertices specified in the URL. NOTE: Bookmarking that URL will bookmark a link which can be used to reopen the polygon again for editing.
ClipboardClipboard(N/A)Select the array syntax (for copying/pasting into your code).

Data format

Vector data has the form [x1, y1, x2, y2, x3, y3, ...., xN, yN]Special "escape" sequences mark color and pen-up transitions:

XYFunction
90007000Pen Up (next line segment is invisible)
900080nnSwitch to color #nn

Color Codes

ValueColor
01BLUE
02WHITE
03GREEN
04YELLOW
05RED
06CYAN
07MAGENTA
08CYAN_DK
09ORANGE
10BROWN
11YELLOW_DK
12GRAY
13GRAY_DK
14LIGHTSKYBLUE
15DODGERBLUE
16LIGHTBLUE

Note: You can load any pre-existing vector from your code into polygondraw by specifying it in the URL; just add a "?" followed by the array data. For example:

http://www.website.com/polygondraw.html?[1,1,4,4]

You can Find Max's work on hisyoutube channel, on hisgithub page, and athttp://www.maxwihlborg.com

This content is released under the (http://opensource.org/licenses/MIT) MIT License.

About

Javascript polygon editor for vector game development.www.vectoralchemy.com

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp