移动网站的光滑反射
在支持 DeviceMotion 事件的设备上,为文本、背景和边框添加闪亮反射效果。
⚠️ 看起来 iOS 12.2 将在 Safari 中禁用设备传感器,因此 Shiny.js 的开发目前暂时搁置
请使用移动设备,目前最好使用竖屏模式的 iPhone
通过 npm 安装:
npm install @rikschennink/shiny --save或者下载 dist/shiny.umd.js,并按如下所示将脚本包含到你的页面中。
目前只有一个 API 调用,即 shiny()。你可以传入一个选择器或元素(或元素数组),第二个参数可以是一个配置对象,用于告诉 Shiny 如何渲染特效。
如果未提供第二个参数,Shiny 将渲染一个径向背景渐变,中心为白色,外圈为透明。
// 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 */ });…暂无开放 Issues,或尚未同步最近议题。