GBoxShadow
Gravity-sensing box-shadow for Flat UI
Install / Use
/learn @Gigacore/GBoxShadowREADME
gBoxShadow.js
Use gravity to update CSS "box-shadow" property.
gBoxShadow.js uses gravity to alter the CSS "box-shadow" property and seamlessly updates offset-x and offset-y values based on the device motion data retrieved from accelerometer & gyroscope of the device to always position the direction of the shadow to the bottom assuming the light source is to your zenith. This adds a natural experience to the UI, especially when used with Material Design.
The plugin uses DeviceMotionEvent and DeviceOrientationEvent Web APIs to detect the moment of your device. gBoxShadow.js is built on top of gyronorm.js to enable consistency of data across different devices.

NOTE:
This is a concept / experimental work. The idea is to re-introduce real-world entity to UI/UX in an much more interactive and intuitive way. Four Shadows is one such attempt that I tried last year, but that was time-aware and had nothing to do with physical entity. It is not recommended to use with your production app, but no harm in trying as the fallback will always ensure that nothing breaks though.
Setup
1. Include jQuery and gBoxShadow.js into your html file.
2. Add the class g-enabled to the element
<div class="g-enabled btn">I am a button</div>
3. Apply box-shadow styling of your choice to the element in your CSS:
.btn {
box-shadow: 10px 10px 15px #A01818;
}
4. Ensure to define the same color and blur values in your HTML using data-shadow-color and data-shadow-blur:
<div class="g-enabled btn" data-shadow-color="#A01818" data-shadow-blur="15">I am a button</div>
Fallback for unsupported devices
The plugin applies the effect only to the devices that support DeviceMotionEvent and DeviceOrientationEvent Web APIs. To those that doesn't, the box-shadow property you set in the CSS will be applied.

Demos
Live: http://gigacore.github.io/demos/gBoxShadow/
Video: https://youtu.be/vkKDyIstcb0
License
The MIT License (MIT)
MIT © 2015 Santhosh Sundar
Related Skills
node-connect
347.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
107.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
Security Score
Audited on Jan 30, 2024
