plumcube 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OThlNTVjNjc2ODc3YTcwNjI5NWQwMGU5NWMwZTFmOWU4MjA1MjM5Mg==
4
+ ZDdmMThiZjk3NTBmNzY4NTdkMmU0OTA5NjJiYmNlNzcyZmExZmQ2ZQ==
5
5
  data.tar.gz: !binary |-
6
- M2VhZTJlMWRiNzQ0ZGY1Yzg1MTVjY2YzMDAzMDJmYjFjMGFmNmEwYQ==
6
+ MmRiODcwMjJhZDI0NGE4NWU1MzQ5YTMxNGVjMWYzYjJhNzRkODMzYQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- Nzc0MDM0NjkzY2RmMDFiN2Y1M2RlZTIxZWQyNmEyOWZlYmJhMzRkYTIzZmE2
10
- YjA1NjkxOWYxNDlkZTg5ZGFlZTJkNjM4Y2FjYTNkZWM4ZTZlYjIzYTdjY2Y3
11
- NTY1YzdhMjJlZGI0NGZmNWEwODRjNzJkYzdhNDJhY2RmOWQ3NGM=
9
+ YTA1YWQyZTI0ZDVjYjVhZGNmZTdkNmIwZjE1MGJkYzc4MWFmYWU4OGIzMGZk
10
+ OTQzMTliYWNkNzdlMDE1YmNmZWJjNGU2OGFiNTM0Y2RhYjg5MzAyYzc3NmFj
11
+ YmY4NWUxOTg1NTY1ZjNhYWNiZmU3ZGViYjE4YzQ3MDhhYzEwYmM=
12
12
  data.tar.gz: !binary |-
13
- MDFkZTUxNDJhYmExOGJhYWMyNDI3NGM0YzBhNDQ0YzVjOWExYWQyMzllNThm
14
- Y2U1MDIyZmQyNTJlZTk5MzkzNTM5YWI2OTUyNGVmYjMzMDhhZWVkYzI5YmZm
15
- OTE1Y2NkZWM2Y2VhMThmOTk1ZTdhMWI5YjgwNzA2MDUxZjFhYzQ=
13
+ Y2NkYjRkNGY0YzFiMWVjNmRiZDhjMDkyNDEyM2Q1NWIzNGE3MDA0MjVhYzI5
14
+ MTIyODNhZDU4NzBkMTM5ZjJlYjI5Y2RjNGE3YjAzMDVlYmFjMzI4NjBhZTg1
15
+ ZWFlZDU0MDg3NWZjOTFlYjc1YTljOWY4Yjk2ZWJkZjcxMjZhNmE=
data/readme.md CHANGED
@@ -44,7 +44,7 @@ Import compass and plumcube:
44
44
 
45
45
  Include the plumcube mixin in the styles of the outermost wrapper element. The plumcube mixin parameters are:
46
46
 
47
- @mixin plumcube($x, $y, $z, $perspective, $origin);
47
+ @mixin plumcube($x, $y, $z, $perspective, $origin)
48
48
 
49
49
  /* ====================================================================================
50
50
  where
@@ -65,4 +65,59 @@ If you wanted a cube 200px x 200px x 200px, with a perspective of 1200px origina
65
65
  margin: 100px 26%;
66
66
  }
67
67
 
68
+ You can then apply other styling to the elements within your cube, including rotating it along one of its axes:
69
+
70
+ .cube-x {
71
+ @include transform(rotateX(10deg)); /* rotate the cube 10 degrees along the x-axis */
72
+
73
+ li {
74
+ opacity: .5; /* set opacity to see all faces of cube */
75
+
76
+ &:nth-child(1) { /* front face */
77
+ background: #f00;
78
+ }
79
+ &:nth-child(2) { /* right face */
80
+ background: #ff0;
81
+ }
82
+ &:nth-child(3) { /* back face */
83
+ background: #ff00ff;
84
+ }
85
+ &:nth-child(4) { /* left face */
86
+ background: #123456;
87
+ }
88
+ &:nth-child(5) { /* top face */
89
+ background: #dd0000;
90
+ }
91
+ &:nth-child(6) { /* bottom face */
92
+ background: #000;
93
+ }
94
+ }
95
+ }
96
+
97
+ ### Take it for a spin
98
+ After you recover from that terrible pun, you can include the `spincube` mixin in your container styles to set the cube on a continuous rotation around one or more of its axes:
99
+
100
+ @mixin spincube($axis, $speed)
101
+
102
+ /* ====================================================================================
103
+ where
104
+ $axis = axis to spin
105
+ $speed = time it takes to complete one rotation, in seconds or milliseconds
106
+ ==================================================================================== */
107
+
108
+ You need to call the mixin on the container representing the axis that you want to set spinning:
109
+
110
+ .cube-x {
111
+ @include spincube(x, 200ms);
112
+ }
113
+ .cube-y {
114
+ @include spincube(y, 5s);
115
+ }
116
+ .cube-z {
117
+ @include spincube(z, 1s);
118
+ }
119
+
120
+
121
+ You can technically spin all 3 axes at once, but the animation looks best when kept simple and limited to one axis.
122
+
68
123
  ### Stay tuned for the next installment, in which I actually attempt to sit down and focus for long enough to complete these instructions!
@@ -7,6 +7,18 @@ import helper functions
7
7
  cube it up
8
8
  ================================================== */
9
9
  @mixin plumcube($x, $y, $z, $perspective, $origin) {
10
+ /* ====================================================================================
11
+ where
12
+ $x = cube width, in pixels
13
+ $y = cube length, in pixels
14
+ $z = cube depth, in pixels
15
+ $perspective = distance of shape from screen along z-axis
16
+ (smaller numbers create more shape/perspective distortion)
17
+ $origin = defines the origin of the 3D perspective
18
+ (see https://developer.mozilla.org/en-US/docs/Web/CSS/perspective-origin
19
+ for all possible values)
20
+ ==================================================================================== */
21
+
10
22
  @include perspective($perspective+px);
11
23
  @include perspective-origin($origin);
12
24
  width: $x + px;
@@ -64,6 +76,15 @@ cube it up
64
76
  /* ==================================================
65
77
  360-degree cube rotation
66
78
  ================================================== */
67
- @mixin spincube($direction, $speed) {
68
- @include private-animation(private-spin+to_upper_case($direction) $speed linear infinite);
79
+ @mixin spincube($axis, $speed, $reverse:"") {
80
+ /* ====================================================================================
81
+ where
82
+ $axis = axis to spin
83
+ $speed = time it takes to complete one rotation, in seconds or milliseconds
84
+ ==================================================================================== */
85
+ @if $reverse != "" {
86
+ @include private-animation(spin+to_upper_case($axis) $speed linear infinite reverse);
87
+ } @else {
88
+ @include private-animation(spin+to_upper_case($axis) $speed linear infinite);
89
+ }
69
90
  }
@@ -20,8 +20,8 @@ animation property builder -> adds -webkit prefix
20
20
  /* ==================================================
21
21
  css transform for 360-degree spin
22
22
  ================================================== */
23
- @mixin private-spin($axis) {
24
- @include private-keyframes(private-spin+$axis) {
23
+ @mixin spin($axis) {
24
+ @include private-keyframes(spin+$axis) {
25
25
  from {
26
26
  @include transform(rotate+$axis+'(0deg)');
27
27
  }
@@ -34,6 +34,6 @@ css transform for 360-degree spin
34
34
  /* ==================================================
35
35
  define 360-degree spin for each axis
36
36
  ================================================== */
37
- @include private-spin(X);
38
- @include private-spin(Y);
39
- @include private-spin(Z);
37
+ @include spin(X);
38
+ @include spin(Y);
39
+ @include spin(Z);
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plumcube
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephanie Plumeri
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-23 00:00:00.000000000 Z
11
+ date: 2013-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sass