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

parallax-js-apsys

v0.0.1

Published

Library for working with Parallax views.

Downloads

2

Readme

Parallax.js

A library for making parallax views.


Demo

A working demo can be seen at https://mobiushorizons.github.io/parallax.js/

API

(parallax).init

Function init takes one parameter container which is the container of your dynamic elements.

Return :
This returns the view object to which you add the dynamic elements with their properties.

(parallax).uniform

Utility Function uniform is used for generating standard percentage based deviation configurations

Param: percentage -- the percentage deviation.

Return: a configuration that can be passed to add

(view).add

Function add adds an element to the animation loop, and describes how it will move.

@parameter element   This is the element to be animated.
@parameter setpoints this is an array of points where the configuration is specified.
@parameter exponent  [optional] weights are taken to this value (weight ^ exponent). default value is 1.

each setpoint has the following properties:

  pos       : [%x, %y], // this is the position in the viewport that this configuration is active.
  translate : [%x, %y],  // offset from original position as a percentage of viewport.
  rotate    : [x , y ],  // rotation in degrees.
  scale     : [ zoom ]   // zoom factor

(view).matrix

Function matrix adds a group of elements that should be dealt with in a matrix or grid.

@parameter elements  This is a matrix (array of rows of elements).
@parameter setpoints This is an array of points where the configuration is specified.
@parameter exponent  [optional] weights are taken to this value (weight ^ exponent). default value is 1.

each setpoint has the following properties:

  pos       : [%x, %y], // this is the position in the viewport that this configuration is active.
  explode   : %       , // this is the percentage of the viewport by which elements in the matrix are translated from the center.
  rotate    : degrees , // the number of degrees to rotate. 

Example

  // initialize viewport
  var viewport = document.GetElementById("container");
  var item     = document.GetElementById("item1");

  // Get Matrix Images
  var [m11, m12, m13] = document.querySelectorAll(".row1 img");
  var [m21, m22, m23] = document.querySelectorAll(".row2 img");
  var [m31, m32, m33] = document.querySelectorAll(".row3 img");

  var view = parallax.init(viewport)
  
  /* item1 will transition smoothly between the two configurations below 
   * based on how close the mouse is to *pos*.
   *******/

  view.add(item1, [
      {
        pos       : [0,0],      // top-left corner
        translate : [-10, -10], // offset -10%, -10%
        rotate    : [0, -45],   // rotated -45deg about the Y axis.
        scale     : [1]         // original zoom.
      },
      {
        pos       : [100,100], // bottom-right corner
        translate : [10, 10],   // offset 10%, 10%
        rotate    : [0, 45],    // rotated 45deg about the Y axis.
        scale     : [1]         // original zoom.
      }
    ]
    
    view.matrix(
    [
      [m11, m12, m13],
      [m21, m22, m23],
      [m31, m32, m33]
    ],
    [
      {
        pos : [10,40],
        explode: 0,
        rotate: 0
      },
      {
        pos : [50, 40],
        explode : 0,
        rotate: 0
      },
      {
        pos : [10, 80],
        explode : 0,
        rotate: 0
      },
      {
        pos : [50, 80],
        explode : 0,
        rotate: 0
      },
      {
        pos : [30, 60],
        explode : 3,
        rotate: 45
      }
    ], 5);
  );