1.0.14 • Published 3 years ago

@kissmybutton/motorcortex-leonsans v1.0.14

Weekly downloads
90
License
MIT
Repository
github
Last release
3 years ago

motorcortex-LeonSans

Demo

Installation

$ npm install --save @kissmybutton/motorcortex-leonsans
# OR
$ yarn add @kissmybutton/motorcortex-leonsans

Loading

import {loadPlugin} from "@kissmybutton/motorcortex/";
import LeonPlugin from "@kissmybutton/motorcortex-leonsans";
const LeonSans = loadPlugin(LeonPlugin);

LeonSans Clip

By the use of the plugin's Clip you can instantiate / render a text anywhere in your DOM. The Incident will render a canvas which will host your text.

The Clip takes a number of attributes (listed below) that define both the canvas and the rendered text characteristics and it can accept an unlimited number of LeonSans Incidents that can animate the rendered text.

Example

const clipName = new LeonSans.Clip(
  {
    canvasId: "leonObj",
    sw: 800,
    sh: 600,
    text: "abcdefghijklmn\nopqrstuvwxyz",
    weight: 100,
    round: true,
    multiply: true,
    drawing: "colorful",
    color: [["#64d3ce", "#2a92ce82", "#2a92ce40", "#2a92ce2e", "#2a92ce00"]],
    colorful: ["#64d3ce", "#2a92ce82", "#2a92ce40", "#2a92ce2e", "#2a92ce00"],
    pathGap: -1,
    patternWidth: 1,
    patternHeight: 10,
    speed: 1,
    tracking: 20,
    leading: 10,
    size: 80
  },
  {
    selector: ".test",
   
  }
);

Supported Attrs explained

NameAreValues
canvasIdthe id of the rendered canvas that contains the text. This id will be used by all LeonIncident Incidents, added to the Clip timeline, via their selector propertystring
swwidth of clip canvas (how many pixels)all positive numbers
shheight of clip canvas (how many pixels)all positive numbers
textthe text to displaystring
weightThe weight of the fontnumber 1 - 900
roundround the corners of font if they are not pathboolean
multiplyapplying multiply effect when the font has more then 1 colorsboolean
drawingtype of the font effectone of: drawing, pattern, colorful, colorPattern
colorThe colors of the charactersarray of arrays of colors
colorfulThe list of colors of each character. Only applicable if drawing property is colorfullarray of colors
pathGapThe gap between each coordinate of the points on a line of each characternumber
patternWidth:the width of the lines when drawing property is patternnumber
patternHeightthe height of the lines when drawing property is patternnumber
speedspeed of color changing when drawing property is colorPatternnumber, from 0 to 10
trackingThe spacing between the characters of a block of textnumber
leadingThe distance between each line of textnumber
sizesize of textnumber

LeonIncident

Example

const nameOfIncident = new LeonSans.LeonIncident(
  {
    animatedAttrs: {
      LeonAtrs: {
        completion_rate: 1,
        weight: 600,
        // tracking: 20,
        leading: 10,
        // size: 90,
        // pathGap: 1,
        patternWidth: 100
        // patternHeight: 90
      }
    },
    initialValues: {
      LeonAtrs: {
        completion_rate: 0,
        weight: 100,
        // tracking: 10,
        // leading: 1,
        size: 80,
        // pathGap: 0,
        patternWidth: 1
        // patternHeight: 10
      }
    }
  },
  {
    duration: 2000,
    selector: "!#leonObj"
  }
);

Supported Attrs explained

The LeonIncident attrs takes on the animatedAttrs object just one composite attribute: LeonAtrs. The supported attributes of this composite attribute are:

NameAreValues
completion_rateThe rate of text completionnum from 0 to 1
weightThe weight of the font: 1 - 900number
pathGapThe gap between each coordinate of the points on a line of each characternumber
patternWidth:the width of the lines when drawing property is patternnumber
patternHeightthe height of the lines when drawing property is patternnumber
trackingThe spacing between the characters of a block of textnumber
leadingThe distance between each line of textnumber
sizesize of textnumber

Along with the attributes, all LeonIncident incidents must take on their props the selector key which targets the canvas id of their parent Clip via the convention: !#<canvasId>

License

MIT License

Kiss My Button

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

5 years ago