Code Monkey home page Code Monkey logo

patterns-generator's Introduction

Patterns generator

https://www.figma.com/community/plugin/1242738296070075685/Pattens-generator

https://www.figma.com/community/plugin/1242738296070075685/Pattens-generator

Wanna make shapes with patterns in figma? The plugin help you to create pattern by a single clicks.

Using stack

  • React
  • Mantine
  • react-hot-toast
  • zod

References

This plugins is start with Figma Plugin React Template from https://github.com/nirsky/figma-plugin-react-template

Todo

  • ✅ Add favourite history
  • ✅ Edit favourite history
  • ⬜️ Generate images patterns (TBD)
  • ✅ Generate text patterns
  • ✅ Search template / favourite slot
  • ✅ Random density and base color
  • ✅ Small card display UI
  • ✅ Glow / Effects mode on nodes
  • ✅ Import and export patterns for share and advance use

Import and Export Guide

The Import and Export features are added in 24/07/2023, which allow users to share their own patterns in a efficient ways.

A default patterns data will be like the following

{
  "rows": 5,
  "cols": 5,
  "paddingRows": 80,
  "paddingCols": 80,
  "shitfRows": 0,
  "shitfCols": 0,
  "density": 80,
  "shapeSize": 25,
  "shapes": "Ellipse",
  "textContent": "",
  "color": "#FFFFFF",
  "randomMode": false,
  "randomDensity": 0.5,
  "rotation": 0,
  "effectsMode": "Null",
  "effectsConfig": {
    "color": "#FFFFFF",
    "intensity": 1,
    "layers": 6
  },
  "flatten": false
}

Here's the regarding types

export interface ShapesGenData {

    // How many object will be generate reagrding x and y
    rows: number, // >= 1 , y axis
    cols: number, // >= 1 , x axis

    // Padding of x and y
    paddingRows: number, // >= 1
    paddingCols: number, // >= 1

    // Added in 27/02/2024
    // For even rows / cols, the whole line will be shift x spacing
    shitfRows: number,
    shitfCols: number,

    // Padding of both x and y
    density: number, // >= 1

    // Shape Size
    shapeSize: number, // >= 1

    // Final shapes 
    shapes: "Ellipse" | "Rectangle" | "Polygon" | "Star" | "Text" | "Star-4" | "Line" | "Ellipse-half" | "Ellipse-one-four",

    // Angle of all object 
    rotation?: number, // 180 to -180

    // Color of all object
    color?: string, // e.g. #FF4301

    // If shapes === "Text", it shoule contains a textContent
    textContent?: string 

    // If true, the patterns generate will be in random, and "randomDensity" needs to be settle
    randomMode?: boolean 
    randomDensity?: 0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9 | 1 // For random number
    
    // If effectsMode == "Glow", the "effectsConfig" needs to be settle
    effectsMode?:  "Null" | "Glow"
    effectsConfig?: null | {
        color: string,
        intensity: number,
        layers: number
    }

    // Will the final patterns be flatten
    flatten?: boolean,
}

In the Patterns, you will see the Import and Export buttons at the top left sections. Yet, you will also see the Export Shapes items in both Template and Favourite menu.

By clicking the Copy to Board icon, you may export the shapes JSON and share to the Import functions.

Logs

27/02/2024

  • Added shift Rows and Cols spacing for advance usage.

patterns-generator's People

Contributors

r48n34 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.