Class default

Principal class

Hierarchy

Constructors

  • Parameters

    • cssSelector: string

      A css selector, you can use .container, .element#e

    • prevStyles: Partial<CSSStyleDeclaration>

      A JSON object with the initials css styles. Will show in 0%

    • newStyles: Partial<CSSStyleDeclaration>

      A JSON object with the final css styles. Will show in 100%

    Returns default

Properties

cssSelector: string
newStyles: Partial<CSSStyleDeclaration>
prevStyles: Partial<CSSStyleDeclaration>
styleTag: null | HTMLElement

Accessors

  • set run(percent: number): void
  • Parameters

    • percent: number

    Returns void

Methods

  • Convert a JavaScript Object (JSON) to CSS Text

    Returns

    Example

    JsonToCssText({margin: "12px", padding: "7px"})// "margin:12px;padding:7px;"
    

    Parameters

    • json: Partial<CSSStyleDeclaration>

      JSON with css properties

    Returns string

  • Extract the numbers to place them in the array

    Example

    exctractNumber("15px 12px 3vw"): [15,12,3]
    

    Parameters

    • string: string

      String charts with numbers

    Returns number[]

  • Convert a number array to string with format The format param is a example of format

    Example

    formattedValues("0px 0vw 0pt", [12, 23, 17]): "12px 23vw 17pt"
    

    Parameters

    • format: string

      String with the format

    • values: number[]

      Array with the values

    Returns string

  • Separed color in int values for add to first color the percened defined to te second color.

    Example

    handleColors("rbg(120, 190, 250)", "rgb(130, 100, 120)", 10): rgb(121, 181, 250)

    this looks like this
    this applies to every number
    substraction = newUnits - prevUnits;
    result = (newUnits * percent) + prevUnits;

    Parameters

    • prevColor: string
    • newColor: string
    • percent: number

    Returns string

  • Add the percentage sent, from the second number to the first

    Example

    handleUnit("20px 30px 40px","10px 40px 50px",10): "19px 31px 41px"

    -This looks like this
    substraction = newUnits - prevUnits;
    result = (newUnits * percent) + prevUnits;

    Parameters

    • prevInts: string
    • newUnits: string
    • percent: number

    Returns string

  • Adds the percentage of the second value to the first value for each item it logs.

    Float is optional and set the ammount the float in the number

    Example

    increaseInSets(45, 32, 17): 42.79
    increaseInSets(45, 32, 17, 0): 42

    Parameters

    • prevValue: number[]

      The old value will be added to this X percentage of the newValue

    • newValue: number[]

      The new value will be multiplied for (percent) and divided by 100

    • percent: number

      This value will be multiplied for newValue and the result will be added to prevValue

    • floats: number = 0

      The amount of numbers decimals in the result.

    Returns number[]

  • Parameters

    • percent: number

    Returns void

  • Convert a hex string to an array of numbers

    Example

    hexToInts("#5544ff") // [5,5,4,4,15,15]
    hexToInts("ccddff") // [12,12,13,13,15,15]

    Parameters

    • hexStrin: string[]

      Hex string

    Returns number[]

  • Convert an array of numbers to a hex string

    Example

    inToHex([15,15,10,10,9,9,00]) // "#ffaa9900"
    inToHex([5,5,4,4,15,15]) // #5544ff

    Parameters

    • numbers: number[]

      array of numbers from 0 to 15

    Returns string

Generated using TypeDoc