npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

real-shadow

v1.4.1

Published

Real Shadow: Photorealistic Shadows of any shape

Downloads

11

Readme

Real Shadow — Module that casts photorealistic shadows of any shape

Perfect for eye-catching demos and landing pages.
Works in any browser supporting CSS box-shadow property.

Real Shadow registers itself as CommonJS module, AMD module or jQuery plugin (it depends on your environment).
If there is no CommonJS, AMD or jQuery, Real Shadow registers itself in the global namespace.

What's new

Basic Usage with jQuery

$(selector).realshadow(); // options are optional

$(selector).realshadow({

	followMouse: false,   // default: true

	pageX: x,             // x coordinate of the light source
	pageY: y              // y coordinate of the light source

	color: '0,127,255'    // shadow color, rgb 0..255, default: '0,0,0'

	type: 'drop' / 'text' // shadow type

});

Basic Usage without jQuery

realshadow(elements); // options are optional

realshadow(elements, options); // options example listed above

To specify different colors for each element, you can use "data-shadow-color" attribute:

<span data-shadow-color="r,g,b"></span> <!-- values in range 0..255 -->

<span data-shadow-color="255,0,0">red</span>
<span data-shadow-color="0,255,0">green</span>
<span data-shadow-color="0,0,255">blue</span>
<span data-shadow-color="255,255,0">yellow</span>
<span data-shadow-color="0,255,255">cyan</span>
<span data-shadow-color="255,0,255">violet</span>
<span data-shadow-color="100,100,100">grey</span>
$('span').realshadow();

Inset Shadows

$(selector).realshadow({
	inset: true // default: false
});

Inverse Shadows

$(selector).realshadow({
	inverse: true // default: false
});

Custom Shadow Shape

$(selector).realshadow({
	type: 'drop'
});

Text Shadow

$(selector).realshadow({
	type: 'text'
});

Constant Angle

If you would like the shadows angle to be constant, specify the 'angle' option, in radians.

$(selector).realshadow({
    angle: Math.PI / 4
});

Update shadows during/after jQuery animations

// before: apply Real Shadow to elements:
$(selector).realshadow(/* options, if needed */);

// update shadows during jQuery animation, i.e. each animation step:
$(selector).animate(/* animated properties */, {step: $.fn.realshadow.update});

// update shadows after jQuery animation is over:
$(selector).animate(/* animated properties */, $.fn.realshadow.update);

If you update shadows during jQuery animation, you don't need to update shadows after jQuery animation is over.

Custom shadows length

$(selector).realshadow({
	length: 5 // default is 7
});

CommonJS usage

var realshadow = require('realshadow');

realshadow(document.getElementsByClassName('someClass'));
realshadow(document.getElementsByTagName('li'), options);

RequireJS / AMD usage

require(['realshadow'], function(realshadow) {

	realshadow(document.getElementsByClassName('someClass'));
	realshadow(document.getElementsByTagName('li'), options);

});

Reset Real Shadow

Real Shadow will release all added elements and remove all its event listeners

// if you have Real Shadow in the current scope:
realshadow.reset();

// if you use jQuery:
$.fn.realshadow.reset();

Getting Real Shadow

Real Shadow is available in GitHub And you can get it using Bower:

bower install real-shadow

If you suppose that the usage of Real Shadow is unclear or have something to say, feel free to contact me.