Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

atv-pivot

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

atv-pivot

Pivot.js ========= Apple TV 3D hover effect in vanilla JS

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Pivot.js

Apple TV 3D hover effect in vanilla JS

Install

npm i -S atv-pivot

Usage

<script src="pivot.js"></script>
<script>pivot.init({ options });</script>
KeyDefaultExpectsExample
selectornullstring.content-block,#search-box
perspectivefalsenumber1000
sensitivityfalsenumber20
invertfalsebooleanfalse
scalefalsebooleantrue
shadowfalsebooleantrue
shinefalsebooleantrue
persistfalsebooleanfalse
positionfalse{object}{
  method: "absolute",
  zindex: 5
}
transitionfalse{object}{
  property: "transform, background-color",
  duration: 0.2,
  timing: "cubic-bezier(0.3,1,0.2,1)"
}
hoverInClassfalse"string"hover-in
hoverOutClassfalse"string"hover-out
hoverClassfalse"string"hovering
touchEnabledtouch()N/AN/A (this function automatically detects touch/no-touch and passes the info down the chain)

Notes on inputs

This plugin is designed to be quite difficult to break. Most inputs are type-checked and improper inputs are substituted for standard values in the event of a mistake. This does mean that the plugin is relatively script when it comes to initiating.

perspective should be provided as a number, to which "px" is then appended to give the value expected for the CSS property. Entering a string here will not work, and will cause the default value to be used.

sensitivity is an internal value used to calculate the magnitude of the rotate transformation. It should be a number and will default to 20 if it is not fed a new number.

invert, scale, shadow, shine and persist are not customisable at the moment. invert, shine and persist are really binary options which can only be flicked on and off—though the actual shine colour could technically be opened up to user customisation. shadow and scale are definitely more customisable, and I will be expanding the code to allow for initial and hovered values for box-shadow in the future; scale will also be opened up to enable the user to pick a scale factor.

position's zindex property expects a number, and if it receives a string it will default to 5. Similarly, transition.duration also expects a number. This number will be handled according to a formatting standard whereby time values in excess of 50 will be assumed to be milliseconds and numbers greater than 1 expected to be decimal fractions of a second. This behaviour can therefore be overridden by supplying a massive number like 3000, but transitions really shouldn't exceed a second or two at maximum, and thus we assume values larger than 1 to be user errors.

transition.timing is a subject for debate. I would prefer to require an [a,r,r,a,y] of four numeric values to fulfil a cubic-bezier curve, but the thought occurs that many users of this plugin might prefer to enter ease or linear. It strikes me that such users can add transition effects from their stylesheet if they cannot work with cubic-bezier curves.

The length of the timeouts for the hover-in and hover-out classes will also be opened up at a later date.

FAQs

Package last updated on 12 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc