JSPM

@twistezo/text-scramble

1.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q25035F
  • License MIT

Text scramble effect

Package Exports

  • @twistezo/text-scramble

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@twistezo/text-scramble) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Text scramble effect

Install

npm install @twistezo/text-scramble

or

yarn add @twistezo/text-scramble

Usage

<!-- HTML file -->
<div class="scramble">
  <span class="scramble__blinker">_</span>
  <span class="scramble__text"></span>
</div>
// SCSS file
.scramble {
  &__blinker {
    animation: blinker 0.5s cubic-bezier(0.5, 0, 1, 1) infinite alternate;
    @keyframes blinker {
      to {
        opacity: 0;
      }
    }
  }

  &__text {
  }
}
// JavaScript file
import TextScramble from '@twistezo/text-scramble'

new TextScramble(
  'scramble__text',
  ['Lorem ipsum 1', 'Lorem ipsum 2', 'Lorem ipsum 3'],
  5,
  100,
  1500
)

TextScramble constructor arguments:

/**
 * @param {string} domClass - DOM class to inject
 * @param {String[]} sentences - Array of sentences
 * @param {number} symbolChangeTime - Time to switch next random symbol [ms]
 * @param {number} oneLetterTime - Time to finish letter [ms]
 * @param {number} nextDelay - Delay beofre start new sentence [ms]
 */