npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ng-scramble

v1.0.1

Published

Scramble transition effect for strings

Downloads

1

Readme

Table of Contents

Features

  • Transition between different strings using a scramble effect
  • Three different scramble and unscramble strategies (Randomized, left to right, right to left)
  • Transition speed adjustment
  • Text display duration adjustment
  • Specify characters to use during scramble
  • Option to padd the provided strings so they all scramble to the same length

Installing

Package manager

Using npm:

npm install ng-scramble

Using yarn:

yarn add ng-scramble

Once the package is installed, you can import the library using import or require approach:

import { ScrambleTextComponent } from "ng-scramble";

It is configured as a standalone component so it can either be imported into a module or a component imports

@Component({
  selector: 'app-component',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss'],
  standalone: true,
  imports: [CommonModule, NgScramble],
})

To render it in the template

<ng-scramble [content]="textArray" [consistentSize]="true|false"></ng-scramble>

Example

<ng-scramble
  [content]="textArray"
  [consistentSize]="true"
  [scrambleMethod]="'LEFT-TO-RIGHT'"
  [unscrambleMethod]="'LEFT-TO-RIGHT'"
  [characterSet]="'ABCDEF'"
  [cycleInterval]="10"
  [displayCycles]="250"
  [textSelection]="'RANDOM'"
></ng-scramble>

Live Example

Inputs

  • content
    • description: Array of strings to cycle through by scrambling
    • type: string[]
  • consistentSize
    • description: Whether to pad every string in the array to match the longest string found so the scramble always returns to the same size. It uses the character '\u00A0' for the padding
    • type: boolean
    • default: false
  • scrambleMethod
    • description: Method to use to scramble the text
    • type: string
    • values: 'LEFT-TO-RIGHT' | 'RIGHT-TO-LEFT' | 'RANDOM'
    • default: 'RANDOM'
  • unscrambleMethod
    • description: Method to use to unscramble the text
    • type: string
    • values: 'LEFT-TO-RIGHT' | 'RIGHT-TO-LEFT' | 'RANDOM'
    • default: 'RANDOM'
  • characterSet
    • description: Character set in the form of a string to use for scrambling the text. It will take the string provided and perform a split('') to turn it into an array
    • default: '123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM'
  • cycleInterval
    • description: Number in ms to define the interval at which the main loop is run. Every loop execution will either unscramble a single character, show the unscrambled text or scramble a sigle character
    • type: number
    • default: 10
  • displayCycles
    • description: Defines how many loop cycles to display the unscrambled text for
    • type: number
    • default: 250
  • textSelection
    • description: Defines how to select the next string in the arary of the content provided.
    • type: string
    • values:
      • 'ORDER' will use the array order to select the next string and loop back to the beginning
      • 'RANDOM' will use a random selection
  • padDirection
    • description: Whether to pad the text right, center or left, this only works if consistentSize is set to true
    • values: 'LEFT' | 'RIGHT' | 'CENTER'
    • default: 'LEFT'
  • timesToRescamble
    • description: Number of times to reshuffle each character in the scrambled text
    • type: number
    • default: 0
  • loop
    • description: Whether to continuosly loop through the text, currently it only works with textSelection 'ORDER'
    • type: boolean
    • default: true

License

MIT