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

pose-core

v2.1.1

Published

Factory for Pose animation state machines

Downloads

256,034

Readme

Pose Core

Factory for Pose animation state machines

npm version npm downloads Twitter Follow Join the community on Spectrum

Install

npm install pose-core --save

Create a poser factory

JavaScript

import poseFactory from 'pose-core';

const pose = poseFactory(config);

TypeScript

const pose = poseFactory<Value, Action, Poser>(config);

Config options

All config options are mandatory.

getDefaultProps

Returns default properties to be injected into every poser's config.props property.

(config: PoserConfig) => { [key: string]: any }

readValue

Read and return from Value.

(value: Value) => any;

createValue

Create a new Value. Each Value is responsible for tracking a single value defined in the poser's poses.

type CreateValueProps = {
  passiveParent?: Value,
  passiveProps?: any // Passed as the second value in the `passive` tuple
}

(init: any, props?: CreateValueProps) => Value

resolveTarget

Accepts the target as defined in the pose, and returns an animatable version of it. For instance React Animated only animates raw numbers, so it runs every target through parseFloat.

(value: Value, target: any) => any

getTransitionProps

Takes the target as returned from resolveTarget and returns default props to be passed to the entered pose's transition function.

(value: Value, target: any) => { [key: string]: any }

bindOnChange

Bind the onChange callbacks to their respective Values.

type OnChangeMap = { [key: string]: (v: any) => void };
type ValuesMap = Map<string, Value>;

(values: Map<string, Value>, onChange: OnChangeMap) => (key: string) => void;

startAction

Takes an action (ie animation or interaction) and returns the subscription returned from its start (or equivalent) method. This subscription might be the same as the action (in the case of Animated) or different (in the case of Popmotion)

(action: Action, onComplete: Function) => ActionSubscription

stopAction

Takes an action subscription and stops it.

(actionSubscription: ActionSubscription) => void

getInstantTransition

Returns an Action that represents an instant transition. We do this rather than simply set on the corresponding Value because both Animated and Popmotion allow these "instant" actions to be composed with things like a delay action.

(value: Value, to: number) => Action

addActionDelay

Returns an action that delays the execution of the initially provided action.

(delay: number, action: Action) => Action

defaultTransitions

A Map that contains Action factory functions that match the signature of the pose's transition property.

The Map must contain at least a 'default' action factory.

Map<string, (props: Props) => Action>

selectValueToRead

Accepts Value and returns the value returned by poser.get(key: string)

(value: Value) => any

extendAPI

A chance to add methods to the output Poser. For instance the Popmotion Pose factory uses this to append DOM-specific FLIP methods. Simply return api for no change.

(api: Poser) => Poser