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

rxan-core

v2.0.4

Published

Core library for rxan (rxjs animation)

Downloads

23

Readme

rxan-core

npm latest version npm total download github license github latest tag github commit from latest

Core package for rxan

FOR RXJS@^5 SUPPORTS

This version is for supporting rxjs@^6.

To see stable version that supports rxjs@^5, please check stable branch.

Table of Contents

Requirement

This package requires rxjs@^6 as peer dependency. You should install RxJS in your project to use this package.

How to install

npm install rxan-core
# To install RxJS too,
npm install rxjs

How to use

with jQuery

const $ = require('jQuery')
const rxanC = require('rxan-core')
const map = require('rxjs/operators').map

const target = $('#target')

// Make animation for 500 ms. It generates value from 0 to 1.
rxanC.during()(500).pipe(
  map(function (percent) {
    return percent * 100                // mapping 0~1 to 0~100
  })
)
  .subscribe(function (marginTop) {
    target.css('marginTop', marginTop)  // assign 0~100 to marginTop of target
  })

with React (you can also use rxan-react)

import React, { Component } from 'react'
import { during, easing } from 'rxan-core'

class Example extends Component {
  constructor(props) {
    super(props)

    this.state = {
      // Initial value for marginTop
      marginTop: 0
    }

    this.subscription = during()(500).pipe(
      map((percent) => percent * 100) // mapping 0~1 to 0~100
    )
      .subscribe((marginTop) => {
        this.setState({
          marginTop: marginTop         // assign 0~100 to state.marginTop
        })
      })
  }

  componentWillUnmount() {
    this.subscription.unsubscribe()
  }

  render() {
    return (
      <div style={{ marginTop: this.state.marginTop }}>
        Example!
      </div>
    )
  }
}

APIs

msElapsed

  • Usage
    msElapsed(scheduler)
  • Description Function that makes an observable of elapsed times. This emits values everytime its scheduler schedules. For example, without any scheduler (i.e., with default animationFrame scheduler), this emits a value per animation frame.
  • Parameters
    • scheduler Rx.js Scheduler or undefined. For undefined case, default scheduler is animationFrame scheduler.
  • Warnings
    • Do not use queue scheduler as scheduler. Such uses make an inifinite loop.
    • You should unsubscribe this, since this function makes an infinite length observable. If you do not unsubscribe this, it will not garbage collected.

during

  • Usage
    during(scheduler)(duration)
  • Description Function that makes an observable of values from 0 to 1. Emitted values are percent of time per duration, i.e., this initially emits 0, and finally emits 1 after specified duration. This emit values only when its scheduler schedules.
  • Parameters
    • scheduler Rx.js Scheduler or undefined. For undefined case, default scheduler is animationFrame scheduler.
    • duration Positive Number. Duration for animation.
  • Warning
    • Do not use queue scheduler as scheduler. Such uses make an inifinite loop.

periodOf

  • Usage
    periodOf(scheduler)(period, cycles)
  • Description Function that makes an observable emits value once per period. This emits the current cycle of this period, start from 1. This does not emit 1 immediately. This emit it after first period passed. This emit values only when its scheduler schedules.
  • Parameters
    • scheduler Rx.js Scheduler or undefined. For undefined case, default scheduler is animationFrame scheduler.
    • period Positive Number. Period of animation.
    • cycles Positive Number or undefined. Cycles of animation. This function emit values cycles times and final value is cycles. For undefined case, default value is Number.POSITIVE_INFINITY.
  • Warning
    • You should unsubscribe this when third argument is undefined or Number.POSITIVE_INFINITY, since such calls for this function make an infinite length observable. If you do not unsubscribe this, it will not garbage collected.

toggle

  • Usage
    toggle(scheduler)(period, cycles)
  • Description Function that makes an observable emits boolean once per period. First boolean is true, and next is false, and next is true, ... and so on. This does not emit true immediately. This emit it after first period passed. This emit values only when its scheduler schedules.
  • Parameters
    • scheduler Rx.js Scheduler or undefined. For undefined case, default scheduler is animationFrame scheduler.
    • period Positive Number. Period of animation.
    • cycles Positive Number or undefined. Cycles of animation. This function emit values cycles times and final value is cycles % 2 === 1. For undefined case, default value is Number.POSITIVE_INFINITY.
  • Warning
    • You should unsubscribe this when third argument is undefined or Number.POSITIVE_INFINITY, since such calls for this function make an infinite length observable. If you do not unsubscribe this, it will not garbage collected.

easing

Easing functions are for mapping values between 0~1 to curve-shaped values starts from 0 and ends at 0. Every easing functions have its in, out, inout variants. You can use those like easing.back.out. Default function itself is in version. (i.e., easing.back === easing.back.in)

easing.back

| In version | Out version | InOut version | |------------|-------------|---------------| ||||

easing.bounce

| In version | Out version | InOut version | |------------|-------------|---------------| ||||

easing.circle

| In version | Out version | InOut version | |------------|-------------|---------------| ||||

easing.cubic

| In version | Out version | InOut version | |------------|-------------|---------------| ||||

easing.elastic

| In version | Out version | InOut version | |------------|-------------|---------------| ||||

easing.exponential

| In version | Out version | InOut version | |------------|-------------|---------------| ||||

easing.linear

| In version | Out version | InOut version | |------------|-------------|---------------| ||||

easing.quadratic

| In version | Out version | InOut version | |------------|-------------|---------------| ||||

easing.sine

| In version | Out version | InOut version | |------------|-------------|---------------| ||||

Author

  • Junyoung Clare Jang: @ailrun