Skip to content

Instantly share code, notes, and snippets.

View PavelLaptev's full-sized avatar
📺
Long live the new flesh!

Pavel Laptev PavelLaptev

📺
Long live the new flesh!
View GitHub Profile
export const generateStripeTexture = (
text,
colors = { main: "#ffa1a1", second: "blue" }
) => {
const copyAmount = 2;
const canvasSize = 640;
const fontSize = canvasSize / copyAmount;
const fontStyle = `Bold ${fontSize}px Arial`;
const bitmap = document.createElement("canvas");
@PavelLaptev
PavelLaptev / generateTexture.js
Created September 11, 2020 13:31
generateTexture.js
export const generateTexture = (text) => {
// Set variables
const bitmapShift = 80;
const copyAmount = 4;
const canvasSize = 300;
const fontSize = canvasSize / copyAmount;
const fontStyle = `Bold ${fontSize}px Arial`;
// Create canvas
const bitmap = document.createElement("canvas");
import {figmaNotify} from './';
export default function populateOnlySelected(selectedLayers, obj, btnName) {
selectedLayers.map((item, i) => {
if (typeof obj[i] !== 'undefined') {
try {
figma.loadFontAsync(item.fontName).then(() => {
item.characters = obj[i][btnName].toString();
});
} catch (error) {
export default function populateByTemplateString(selectedLayers, JSONobj, btnName) {
let newItem = 0;
const loopSelected = arr => {
arr.map(item => {
if (item.type === 'TEXT' && item.characters.includes(`{${btnName}}`)) {
figma.loadFontAsync(item.fontName).then(() => {
item.characters = item.characters.replace(`{${btnName}}`, JSONobj[newItem][btnName].toString());
newItem = ++newItem;
});
export default function populateByName(selectedLayers, JSONobj, btnName) {
let newItem = 0;
const loopSelected = arr => {
arr.map(item => {
if (item.name.toUpperCase() === btnName.toUpperCase() && item.type === 'TEXT') {
figma.loadFontAsync(item.fontName).then(() => {
item.characters = JSONobj[newItem][btnName].toString();
newItem = ++newItem;
});
.grid {
box-sizing: border-box;
display: flex;
margin-left: auto;
margin-right: auto;
flex-wrap: wrap;
max-width: 1400px;
width: 88.5714285714%;
}
@media screen and (max-width: 1020px) {
// FLEXBOX CSS GRID
// by Laptev Pavel
// VARiABLES
// desktop grid
$grid-desktop-columns: 12;
$grid-desktop-sideMargin: 80px;
$grid-desktop-gutter: 40px;
$grid-desktop-breakpoint: 1400px;
import * as React from "react"
import { PropertyControls, ControlType } from "framer"
const style: React.CSSProperties = {
height: "100%",
display: "flex",
alignItems: "center",
justifyContent: "center",
textAlign: "center",
color: "#FFF",
import { RGBToHEX } from "./RGB-to-HEX";
import { toCamelCase } from "./to-camel-case";
import { downloadJSON } from "./download-JSON";
/////////////// Get Functions ///////////////
/////////////////////////////////////////////
////////////////// Spacers //////////////////
const getSpacers = (stylesArtboard) => {
let spacers = {};
// Watch online
let dataWatchCard = Data({
currentCardId: null,
prevCardId: null,
currentCardTitleId: null,
prevCardTitleId: null,
currentTitleId: null,
prevTitleId: null,
currentPlayBtnId: null,
prevPlayBtnId: null