Skip to content

Commit 6a04762

Browse files
author
Denis Malinochkin
committed
v2.0.0
1 parent 4721d74 commit 6a04762

18 files changed

+835
-563
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
* **v2.0.0** (2015-03-01)
2+
- Completely revised structure.
3+
- Correct settings for shadows.
4+
- Removed class generator for shadows as class.
5+
- Added class generator for shadows as mixin.
6+
- Added tests.
7+
- Added changelog file.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2015 Denis Malinochkin
3+
Copyright (c) 2014-2015 Denis Malinochkin
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Installation
1818
How to use
1919
--------------
2020

21-
Just import the file, whitch includes mixins in your project.
21+
Just import the file, which includes mixins in your project.
2222

2323
**Less:**
2424

@@ -53,7 +53,7 @@ If you use Bower, the path would be:
5353
- **(depth)** - Depth 1..5.
5454
- **(orientation)** - None, Top or Bottom.
5555

56-
**Example (Less):**
56+
**Simple example (Less):**
5757

5858
````Less
5959
@import "lib/material-color";
@@ -69,12 +69,41 @@ If you use Bower, the path would be:
6969
}
7070
````
7171

72-
**Settings**
72+
HTML for `.z-depth-animation()`:
7373

74-
````Text
75-
// If True, then will be CSS classes, type: .z-depth-*
76-
z-depth-css = [true | false (default)];
77-
z-depth-animation = [true (default) | false];
78-
z-depth-animation-time = .28s;
79-
z-depth-animation-function = cubic-bezier(.4, 0, .2, 1);
74+
````HTML
75+
<div class="z-depth-animation">
76+
<div class="z-depth-2">.z-depth-2</div>
77+
</div>
8078
````
79+
80+
**Class generator example (less):**
81+
82+
Options for animation:
83+
84+
- @animation: [true (default) | false];
85+
- @time: .28s;
86+
- @function: cubic-bezier(.4, 0, .2, 1);
87+
88+
````Less
89+
@import "lib/material-color";
90+
91+
// Class mixin
92+
.z-depth {
93+
.z-depth-class();
94+
}
95+
96+
// => (output)
97+
.z-depth-1 {
98+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.16), 0 2px 10px rgba(0, 0, 0, 0.12);
99+
}
100+
.z-depth-1-top {
101+
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
102+
}
103+
.z-depth-1-bottom {
104+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.16);
105+
}
106+
// and more
107+
````
108+
109+
More examples in the test directory.

bower.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "material-shadows",
3-
"version": "1.0.1",
3+
"version": "2.0.0",
44
"authors": [
5-
"Denis Malinochkin <[email protected]>"
5+
"@mrmlnc (Denis Malinochkin)"
66
],
77
"description": "Mixins library: Paper shadows of material design",
88
"keywords": [

example.html

Lines changed: 0 additions & 44 deletions
This file was deleted.

material-shadows-prefixed.less

Lines changed: 56 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,122 +1,93 @@
1-
// ================================================================================
21
//
32
// Name: Material Shadows
43
// Description: Paper shadows of material design.
5-
// Version: 1.0.1
4+
// Version: 2.0.0
65
//
76
// Author: Denis Malinochkin
87
// Git: https://github.com/mrmlnc/material-shadows
98
//
109
// twitter: @mrmlnc
1110
//
12-
// ================================================================================
13-
14-
// Settings
15-
// --------------------------------------------------------------------------------
16-
17-
@md-z-depth-css: false;
18-
@md-z-depth-animation: true;
19-
@md-z-depth-animation-time: .28s;
20-
@md-z-depth-animation-function: cubic-bezier(.4, 0, .2, 1);
21-
22-
23-
24-
// Shadows
25-
// --------------------------------------------------------------------------------
26-
27-
// md-z-depth-1
28-
@md-z-depth-1-top: 0 2px 10px 0 rgba(0, 0, 0, 0.16);
29-
@md-z-depth-1-bottom: 0 2px 5px 0 rgba(0, 0, 0, 0.26);
30-
31-
// md-z-depth-2
32-
@md-z-depth-2-top: 0 6px 20px 0 rgba(0, 0, 0, 0.19);
33-
@md-z-depth-2-bottom: 0 8px 17px 0 rgba(0, 0, 0, 0.2);
34-
35-
// md-z-depth-3
36-
@md-z-depth-3-top: 0 17px 50px 0 rgba(0, 0, 0, 0.19);
37-
@md-z-depth-3-bottom: 0 12px 15px 0 rgba(0, 0, 0, 0.24);
38-
39-
// md-z-depth-4
40-
@md-z-depth-4-top: 0 25px 55px 0 rgba(0, 0, 0, 0.21);
41-
@md-z-depth-4-bottom: 0 16px 28px 0 rgba(0, 0, 0, 0.22);
42-
43-
// md-z-depth-5
44-
@md-z-depth-5-top: 0 40px 77px 0 rgba(0, 0, 0, 0.22);
45-
@md-z-depth-5-bottom: 0 27px 24px 0 rgba(0, 0, 0, 0.2);
46-
11+
// ------------------------------------
4712

4813

4914
// Mixins
50-
// --------------------------------------------------------------------------------
51-
52-
// Top & Bottom
53-
.md-z-depth(@depth: 1) {
54-
box-shadow: ~"@{md-z-depth-@{depth}-bottom}, @{md-z-depth-@{depth}-top}";
55-
}
15+
// ------------------------------------
5616

57-
// Top
17+
// Generator for top shadow
5818
.md-z-depth-top(@depth: 1) {
59-
box-shadow: ~"@{md-z-depth-@{depth}-top}";
19+
@color: .12, .19, .19, .21, .22;
20+
@offset-y: 2px, 6px, 17px, 25px, 40px;
21+
@blur: 10px, 20px, 50px, 55px, 77px;
22+
23+
box-shadow+: 0 extract(@offset-y, @depth) extract(@blur, @depth) rgba(0, 0, 0, extract(@color, @depth));
6024
}
6125

62-
// Bottom
26+
// Generator for bottom shadow
6327
.md-z-depth-bottom(@depth: 1) {
64-
box-shadow: ~"@{md-z-depth-@{depth}-bottom}";
28+
@color: .16, .2, .24, .22, .2;
29+
@offset-y: 2px, 8px, 12px, 16px, 27px;
30+
@blur: 5px, 17px, 15px, 28px, 24px;
31+
32+
box-shadow+: 0 extract(@offset-y, @depth) extract(@blur, @depth) rgba(0, 0, 0, extract(@color, @depth));
6533
}
6634

67-
// Animation
68-
.md-z-depth-animation(@depth-after, @depth-orientation: full) {
35+
// Generator for top and bottom shadow
36+
.md-z-depth(@depth: 1) {
37+
.md-z-depth-bottom(@depth);
38+
.md-z-depth-top(@depth);
39+
}
40+
41+
// Generator animation hover and focus effect
42+
.md-z-depth-animation(@depth, @orientation: full) {
6943
&:hover,
7044
&:focus {
71-
& when (@depth-orientation = full) {
72-
.md-z-depth(@depth-after);
45+
& when (@orientation = full) {
46+
.md-z-depth(@depth);
7347
}
7448

75-
& when (@depth-orientation = top) {
76-
.md-z-depth-top(@depth-after);
49+
& when (@orientation = top) {
50+
.md-z-depth-top(@depth);
7751
}
7852

79-
& when (@depth-orientation = bottom) {
80-
.md-z-depth-bottom(@depth-after);
53+
& when (@orientation = bottom) {
54+
.md-z-depth-bottom(@depth);
8155
}
8256
}
8357
}
8458

85-
// Class generator - .md-z-depth-*
86-
.md-generate-depth(@i: 1, @count) when (@i =< @count) {
87-
&-z@{i} {
88-
.md-z-depth(@i);
8959

90-
&-top {
91-
.md-z-depth-top(@i);
92-
}
60+
// Classes
61+
// ------------------------------------
62+
.md-z-depth-class(@animation: true, @time: .28s, @function: cubic-bezier(.4, 0, .2, 1)) {
9363

94-
&-bottom {
95-
.md-z-depth-bottom(@i);
96-
}
97-
}
64+
// Generator for shadow classes
65+
.generate-depth-class(@i: 1, @count) when (@i =< @count) {
66+
&-@{i} {
67+
.md-z-depth(@i);
9868

99-
.md-generate-depth(@i + 1, @count);
100-
}
69+
&-top {
70+
.md-z-depth-top(@i);
71+
}
72+
73+
&-bottom {
74+
.md-z-depth-bottom(@i);
75+
}
76+
}
10177

78+
.generate-depth-class(@i + 1, @count);
79+
}
10280

81+
.generate-depth-class(1, 5);
10382

104-
// Classes
105-
// --------------------------------------------------------------------------------
106-
107-
.md-z-depth when (@md-z-depth-css = true) {
108-
.md-generate-depth(1, 5);
109-
110-
// md-z-depth-animation
111-
&-animation when (@md-z-depth-animation = true) {
112-
&:hover {
113-
.md-z-depth-z1,
114-
.md-z-depth-z2,
115-
.md-z-depth-z3,
116-
.md-z-depth-z4,
117-
.md-z-depth-z5 {
118-
transition: box-shadow @md-z-depth-animation-time @md-z-depth-animation-function;
119-
}
83+
// z-depth-animation
84+
&-animation when (@animation = true) {
85+
.z-depth-1,
86+
.z-depth-2,
87+
.z-depth-3,
88+
.z-depth-4,
89+
.z-depth-5 {
90+
transition: box-shadow @time @function;
12091
}
12192
}
122-
}
93+
}

0 commit comments

Comments
 (0)