All Projects → rikschennink → Shiny

rikschennink / Shiny

Licence: mit
🌟 Shiny reflections for mobile websites

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Shiny

awesome-ha-blueprints
A curated collection of automation blueprints for Home Assistant.
Stars: ✭ 258 (-90.84%)
Mutual labels:  light, motion
Unityurp Mobilescreenspaceplanarreflection
Reusable RendererFeature of MobileScreenSpacePlanarReflection
Stars: ✭ 260 (-90.77%)
Mutual labels:  mobile
lightsout
🎲 Lights Out Game
Stars: ✭ 23 (-99.18%)
Mutual labels:  light
Hover On Touch
A pure Javascript Plugin for an alternative hover function that works on mobile and desktop devices. It triggers a hover css class on »Taphold« and goes to a possible link on »Tap«. It works with all html elements.
Stars: ✭ 256 (-90.92%)
Mutual labels:  mobile
fluffy.js
🍱 Makes sure your content – no matter how big it is – will fit in any screen!
Stars: ✭ 47 (-98.33%)
Mutual labels:  light
Tabs
The expense sharing app.
Stars: ✭ 259 (-90.81%)
Mutual labels:  mobile
TaichiGAME
GPU Accelerated Motion Engine based on Taichi Lang.
Stars: ✭ 35 (-98.76%)
Mutual labels:  motion
Phytouch
Smooth scrolling, rotation, pull to refresh, page transition and any motion for the web - 丝般顺滑的触摸运动方案
Stars: ✭ 2,854 (+1.28%)
Mutual labels:  motion
Getx
Open screens/snackbars/dialogs/bottomSheets without context, manage states and inject dependencies easily with Get.
Stars: ✭ 5,578 (+97.94%)
Mutual labels:  mobile
licht-theme
A comfortable light theme for VSCode, SublimeText, Atom and TextMate.
Stars: ✭ 31 (-98.9%)
Mutual labels:  light
TTInputVisibilityController
Lightweight controller to keep your inputs visible when the keyboard is presented.
Stars: ✭ 21 (-99.25%)
Mutual labels:  light
plenopticam
Light-field imaging application for plenoptic cameras
Stars: ✭ 111 (-96.06%)
Mutual labels:  light
Flawless Ios
Awesome iOS guides from the community, shared on Flawless iOS Medium blog 👉
Stars: ✭ 260 (-90.77%)
Mutual labels:  mobile
ios logger
Application for camera and sensor data logging (iOS)
Stars: ✭ 60 (-97.87%)
Mutual labels:  devicemotion
Free gait
An Architecture for the Versatile Control of Legged Robots
Stars: ✭ 263 (-90.67%)
Mutual labels:  motion
Real-Time-Abnormal-Events-Detection-and-Tracking-in-Surveillance-System
The main abnormal behaviors that this project can detect are: Violence, covering camera, Choking, lying down, Running, Motion in restricted areas. It provides much flexibility by allowing users to choose the abnormal behaviors they want to be detected and keeps track of every abnormal event to be reviewed. We used three methods to detect abnorma…
Stars: ✭ 35 (-98.76%)
Mutual labels:  motion
illuminanced
Ambient Light Sensor Daemon for Linux
Stars: ✭ 36 (-98.72%)
Mutual labels:  light
Vim Asterisk
❄️ *-Improved
Stars: ✭ 255 (-90.95%)
Mutual labels:  motion
Vue Ydui
A mobile components Library with Vue2.js. 一只基于Vue2.x的移动端组件库。
Stars: ✭ 2,798 (-0.71%)
Mutual labels:  mobile
Thermal Printer In Android
Thermal printer in Android
Stars: ✭ 265 (-90.6%)
Mutual labels:  mobile

Shiny, Simulating Reflections for Mobile Websites

Add shiny reflections to text, backgrounds, and borders on devices that support the DeviceMotion event.

License: MIT Still in beta Less than 1kB

⚠️ It looks like iOS 12.2 will disable use of device sensors on Safari, so development of Shiny.js is on hold for now

Demo

Use a mobile device, preferably iPhone in portrait mode at the moment

Todo

  • Fix landscape orientation rendering
  • Test on Android (waiting for test device to arrive)
  • Add option to pass custom handler

Installation

Install from npm:

npm install @rikschennink/shiny --save

Or download dist/shiny.umd.js and include the script on your page like shown below.

API

There's currently only one API call to make and it's shiny(). You can either pass a selector or an element (or array of elements), the second argument can be a configuration object telling Shiny how to render the special effects.

If the second argument is not supplied Shiny will render a radial background gradient with a white center and a transparent outer ring.

// No config supplied, select element by class
shiny('.my-shiny-element');

// Select multiple elements
shiny('.my-shiny-element, #my-other-shiny-element');

// Configuration object, see below for details
shiny('.my-shiny-element', { /* config here */ });

// Pass element object
const myElement = document.querySelector('my-shiny-element');
shiny(myElement, { /* config here */ });

// Pass array of elements
shiny([myElement, myOtherElement], { /* config here */ });

Usage

<!-- The element you want to make shiny -->
<div class="my-shiny-element">Hello World</div>

<!-- Include the library -->
<script src="shiny.umd.js"></script>

<!-- Initialize the SHINYNESS -->
<script>
shiny('.my-shiny-element', {
    // type of shiny to render, 
    // 'background', 'border', or 'text'
    type: 'background',
    gradient: {

        // type of gradient
        // 'linear' or 'radial'
        type: 'radial',

        // angle of gradient when type is linear
        angle: '110deg',

        // flip axis movement
        flip: {
            x: true,
            y: false
        },

        // colors to use
        colors: [
            // offset, color, opacity
            // ! don't pass rgba or hsla colors, supply the opacity seperately
            [0, '#fff', 1], // white at 0%
            [1, '#fff', 0], // to fully transparent white at 100%
        ]

    },

    // optional pattern fill
    pattern: {
        type: 'noise', // only 'noise' for now
        opacity: .5
    }
});
</script>
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].