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

wobbly

v0.0.8

Published

〰️ parallax all the things in react-vr

Downloads

13

Readme

Travis npm GitHub Issues Coverage Styled with Prettier README generated by emdaer Twitter GitHub stars

wobbly 〰️ manages the state needed to calculate x, y rotations for a parallax effect, allowing you to focus the UI, and apply the effect how/where you want.. It uses the function as child and "prop getter" patterns, which gives you maximum flexibility with a minimal API.

Table of Contents

Installation

This module is distributed via npm which is bundled with node and should be installed as one of your project's dependencies:

npm install --save wobbly

This package also depends on react-vr and react. Please make sure you have those installed as well.

Usage

import Wobbly from 'wobbly';
import { Text, View, VrButton, Animated } from 'react-vr';

function ParallaxButton() {
  return (
    <Wobbly
      // These props control how extreme wobbly 〰 is. Default to -15, 15 respectively.
      parallaxDegreeLowerBound={-20}
      parallaxDegreeUpperBound={20}
      // The render prop is called on each render providing prop getters and state to be used in your UI.
      // This function can alternatively be called as a child prop <Wobbly>{(stateAndHelpers) => {...}}</Wobbly>
      render={({ getMoveTargetProps, getWobblyTransformStyle }) => (
        <Animated.VrButton
          // NOTE: The element you spread the transformation style into must be an "Animated" element.
          style={{
            backgroundColor: 'darkorchid',
            padding: 0.2,
            borderRadius: 0.03,
            // Spread the transform styles into an element you want to make wobbly 〰
            // This adds rotateX and a rotateY objects respectively
            transform: [...getWobblyTransformStyle()],
          }}
          // Spread the wrapper props into an element whose onMove event will control the parallax effect.
          // You can also pass an onMove/onExit handler to be called before wobbly's internal onMove/onExit.
          // ...getMoveTargetProps({ onMove: (event) => {}})
          {...getMoveTargetProps()}
        >
          <Text
            style={{
              fontSize: 0.3,
              color: 'blanchedalmond',
            }}
          >
            Wobbly
          </Text>
        </Animated.VrButton>
      )}
    />
  );
}

...creates something like this: wobbly button example

Props

See the API Docs for information on the props exposed by this package. The usage example above is not an exhaustive list.

How To Render

wobbly 〰️ uses the child callback render function pattern. This is where you render whatever you want to based on the state of wobbly which is passed to the callback as parameters. The function is passed as the child prop of the Wobbly component:

<Wobbly>
  {({/* parameters here */}) => (/* your render code here*/)}
</Wobbly>

or can be called from the render prop

<Wobbly
  render= {({/* parameters here */}) => (/* your render code here*/)}
/>

The paramters of this function can be split into two categories: State and Prop Getters.

See the API Docs for a list of these properties.

Examples

Check out the demo site to see how wobbly 〰️ works in VR. See the demo repo for the code behind the demo site.

Contributing

If you'd like to make wobbly 〰️ better, please read our guide to contributing.

These wonderful people have contributed to wobbly 〰️ in one way or another:

License

wobbly is MIT licensed.