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

positional-react-animations

v1.0.3

Published

Positional based animations for react made simple and easy, just supply coordinates.

Downloads

3

Readme

Positional React Animations - Simple hand crafted cursor animations.

A very easy package to create cool cursor based animations for react.

Demo of animation

Click here to see full blog post about animation (https://atomizedobjects.com/blog/react/tutorial-creating-reactjs-animations-react-hooks/)

Contents.

  • Guide
  • API / Props

Guide - You can use Positional React Animations very easily and quickly.

Step 1.

Install and Import SimpleDnD into your component.

npm install positional-react-animations --save

Step 2.

Add in the components like so:

...
import Positional, { Coord, Img } from 'positional-react-animations';

export default function YourComponent() {
  return (
    <Positional height="100vh" cursorEvent>
      <Coord>
        <span>TEST</span>
      </Coord>
      <Coord x={20} y={70}>
        <span>TEST</span>
      </Coord>
      <Coord x={60} y={40}>
        <span>TEST</span>
      </Coord>
    </Positional>
  );
}

Step 3 (Optional).

Use the pre-packaged <Img /> component to make use of the animation with images.

...
import Positional, { Coord, Img } from 'positional-react-animations';

export default function YourComponent() {
  return (
    <Positional cursorEvent height="100vh">
      <Coord>
        <Img src={myImage} width={500}>
      </Coord>
      <Coord x={20} y={70}>
        <Img src={myOtherImage} width={380}>
      </Coord>
      <Coord x={60} y={40}>
        <Img src={myLastImage} width={1000}>
      </Coord>
    </Positional>
  );
}

The width prop is more of a max-width in this situation.

API / Props

Positional

The parent / container component.

Props:

  • fullWidth
  • height
  • cursorEvent

fullWidth

This is a prop of type bool, it will tell the positional element that you want it to span the full screen. This must be used in combination with the fullWidth prop within the Coord and Img components.

height

This is a prop of type string, it allows any css value followed by a unit. for example:

  height="100vh"

cursorEvent

This is a prop of type bool, that will enable or disable the cursor based animation. It is defaulted to false, so this must be defined to make use of the animation. For example:

<Positional
  cursorEvent
>
  ...
</Positional>

Coord

The child elements that sit inside the Positional component.

Props:

  • x
  • y
  • fullWidth
  • medias
  • shadow
  • intense
  • velocity

x, y

The x / y props are used to plot the position of the component. They are of type number. Think of x as the percentage from the left and y the percentage from the top. The default is 50 for both which will center the component.

fullWidth

This is a prop of type bool, it will tell the coord element that you want it to span the full screen. This must be used in combination with the fullWidth prop within the Positional and Img components.

medias

Media queries for the coordinates. For example:

<Coord
  medias={[
    { query: 768, x: 40, y: 40 },
    { query: 1200, x: 60, y: 60 },
  ]}
/>

shadow

This is a prop of type bool, defining this prop will create a shadow effect on the contents of the coord component that will move at a different speed.

intense

This is a prop of type bool, Adds more depth to the shadows on the coord.

velocity

This is a prop type of number, You can use this to control the speed / velocity of the animation effect

Img

A component to enable the use of images.

Props:

  • src
  • height
  • width
  • fullWidth

src

Accepts any form of image for the source.

height

This is a prop of type number, sets the max height

width

This is a prop of type number, sets the max width

fullWidth

This is a prop of type bool, it will tell the coord element that you want it to span the full screen. This must be used in combination with the fullWidth prop within the Coord and Positional components.