Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the great merge [2.0] #43

Merged
merged 20 commits into from
Nov 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@ dist
dist/ui.html
dist/code.ts
dist/ui.js
/public/build/
/public
public/index.html
src/build
.DS_Store
40 changes: 23 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,45 @@
## In Progress: V 2.0

- [x] switch to new stack (svelte, rollup, pnpm)
- [x] rewrite core bezier algorithm
- [x] rethink "preview" functionality
- [x] refactor "place objects" code
- [ ] rewrite text to path function
- [ ] redesign UI (partially done)
- [ ] implement new ui
- [ ] test and review

# To-Path: A Figma Plugin

![version badge](https://img.shields.io/badge/dynamic/json?color=ff69b4&label=version&query=version&url=https%3A%2F%2Fraw.githubusercontent.com%2Fcodelastnight%2Fto-path-figma%2Fmaster%2Fpackage.json?style=flat-square)


![logo and info image](info.png)

✨ 𝙋𝙪𝙩 𝙖𝙣𝙮 𝙤𝙗𝙟𝙚𝙘𝙩𝙨 𝙤𝙧 𝙩𝙚𝙭𝙩 𝙤𝙣 𝙖 𝙥𝙖𝙩𝙝!✨

1. select a curve
2. select an object, group, or text
3. hit "link" and watch the magic* happen
3. hit "link" and watch the magic\* happen

*Its janky code and its not actually magic
\*Its janky code and its not actually magic

╭┈─────── ೄྀ࿐ ˊˎ-

╰┈➤ 𝙄𝙈𝙋𝙊𝙍𝙏𝘼𝙉𝙏

Version 1.5.0 and higher's revamped live updates WILL NOT
work on previous linked paths made by this plugin!
Version 1.5.0 and higher's revamped live updates WILL NOT
work on previous linked paths made by this plugin!
You must create a new linked path group!

☆゜・。。・゜゜・。。・゜★
゜・。。・゜゜・。。・゜

🌙 𝙄𝙨𝙨𝙪𝙚𝙨 𝙤𝙧 𝙁𝙚𝙖𝙩𝙪𝙧𝙚 𝙍𝙚𝙦𝙪𝙚𝙨𝙩𝙨🌙
🌙 𝙄𝙨𝙨𝙪𝙚𝙨 𝙤𝙧 𝙁𝙚𝙖𝙩𝙪𝙧𝙚 𝙍𝙚𝙦𝙪𝙚𝙨𝙩𝙨🌙

Open an issue on the github:

https://github.com/codelastnight/to-path-figma

☆゜・。。・゜゜・。。・゜★
゜・。。・゜゜・。。・゜

❤️ 𝙇𝙞𝙠𝙚 𝙬𝙝𝙖𝙩 𝙄 𝙙𝙤? ❤️

Expand All @@ -40,26 +49,23 @@ https://ko-fi.com/lastnight

─────────✧❁✧─────────

˚         ⊹           ·  *    ✧    ⋆    · * . · .     · ·       ..   . .       · +       ·  * ✫    * ⊹ * ˚      . .       ·   ⋆        *        .          * .     . ·  .   ·     .           *  ·       . ·   · +  .        · ** ˚      . . +       ·   ⋆        *        .          * .     . ·  .   ·     .           *
˚         ⊹           ·  _    ✧     ⋆    · _ . · .     · ·       ..   . .       · +       ·  _ ✫    _ ⊹ _ ˚      . .       ·   ⋆        _        .          * .     . ·  .   ·     .           *  ·       . ·   · +  .        · \*_ ˚      . . +       ·   ⋆        _        .          _ .     . ·  .   ·     .           _

## How it Works

1. the plugin generates an array of points (420 between each point but you can also change this in the "about" menu) using castejau's algorithm that follows the curve, also finding the angle of the tangent of each point. the length from the start of the curve to each point is also generated and stored (find out more here: https://javascript.info/bezier-curve)
1. the plugin generates an array of points (420 between each point but you can also change this in the "about" menu) using castejau's algorithm that follows the curve, also finding the angle of the tangent of each point. the length from the start of the curve to each point is also generated and stored (find out more here: https://javascript.info/bezier-curve)

2. the nth's object's x position + object width + spacing is calculated
3. the plugin compares the x position of the object with the array of points. 2 points with closest length is picked
3. the plugin compares the x position of the object with the array of points. 2 points with closest length is picked
4. then the plugin finds the point between those two points and finds the exact point to place the object. the angle used is just the tangent of the nearest point.
5. the object is placed and the plugin moves onto the next object.

## development setup

1. install packages:
`npm i`

2. compile :
`npm run prod`


`npm i`

2. compile :
`npm run prod`

mfw someone else already put out something similar to my plugin but i spent too much time on this to stop now.
4 changes: 2 additions & 2 deletions custom.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

interface Point {
//old -- remember to remove
interface Point{
x: number
y: number
angle?: number // in degrees
Expand Down
Loading