1.0.2 • Published 7 years ago

repa-tilt v1.0.2

Weekly downloads
1
License
MIT
Repository
bitbucket
Last release
7 years ago

Tilts the content of the element based on mouse position or mobile device orientation.

See a very basic demo here.

Usage

1 - Install the package

$ yarn add repa-tilt

# or

$ npm i --save repa-tilt

2 - Import the element

<script type="module" src="node_modules/repa-tilt/repa-tilt.js"></script>

or in your javascript file

import "repa-tilt/repa-tilt.js";

3 - Use it in your HTML

<repa-tilt>content here</repa-tilt>

Styling

The following custom properties and mixins are available for styling:

Custom propertyDefaultDescription
--repa-tilt-backgroundtransparentbackground
--repa-tilt-text-color#ffftext color
--repa-tilt-primary-color#44a655primary color (card)
--repa-tilt-secondary-color#6168a5secondary color (card)
--repa-tilt-gradient-deg135deggradient tilt degree
--repa-tilt-z10vhZ axis translation of the content

Properties

PropertyDefaultDescription
no-xfalseX axis disabled
no-yfalseY axis disabled
no-mobilefalsedevice orientation tilt disabled
reversedfalsetilt direction reversed
no-gradientfalsesingle color background

Development

Install the Polymer-CLI

First, make sure you have the Polymer CLI and npm (packaged with Node.js) installed. Run npm install to install your element's dependencies, then run polymer serve to serve your element locally.

Development Server

$ polymer serve

index.html contains only a single empty <repa-tilt> element, please check the demo page under http://localhost:8081/demo/

Running Tests

$ polymer test

Your application is already set up to be tested via web-component-tester. Run polymer test to run your application's test suite locally.

Documentation

When polymer serve is running, the documentation is available under http://localhost:8081/doc.html

###V ES5 Compatible Build

Running

$ polymer build

will generate an ES5 compatible version of the custom element into build/es5 directory. An example index.html will be included there.

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago