jquery-bez-rails 0.1.0 → 0.2.0
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 +4 -4
- data/jquery-bez-rails-0.1.0.gem +0 -0
- data/lib/jquery/bez/rails.rb +8 -0
- data/lib/jquery/bez/rails/engine.rb +11 -0
- data/lib/jquery/bez/rails/version.rb +1 -1
- data/vendor/assets/javascripts/jquery.bez.js +56 -0
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3e0d6c9a1ffed2043af6b961557af7201e09f50
|
4
|
+
data.tar.gz: 443380d512ab21255fc0826178572011e86d7cb4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd35698cee10053e2fc7597f1c7c5974395b7770339e572cad692e02ba166b6a205d414f9fbf95f71e4d88ab50597f2bb4fb746c808853054e07bd6e8c293565
|
7
|
+
data.tar.gz: d3341c23db853a4c39ba39a619630700e3ef920b32e165aa08b3a6a5ce048fc5e89b5802b275a318b41dae7321c85f0f95b92bb2828f2b92be773f1fb5c9c378
|
Binary file
|
data/lib/jquery/bez/rails.rb
CHANGED
@@ -0,0 +1,56 @@
|
|
1
|
+
/*!
|
2
|
+
* Bez @VERSION
|
3
|
+
* http://github.com/rdallasgray/bez
|
4
|
+
*
|
5
|
+
* A plugin to convert CSS3 cubic-bezier co-ordinates to jQuery-compatible easing functions
|
6
|
+
*
|
7
|
+
* With thanks to Nikolay Nemshilov for clarification on the cubic-bezier maths
|
8
|
+
* See http://st-on-it.blogspot.com/2011/05/calculating-cubic-bezier-function.html
|
9
|
+
*
|
10
|
+
* Copyright @YEAR Robert Dallas Gray. All rights reserved.
|
11
|
+
* Provided under the FreeBSD license: https://github.com/rdallasgray/bez/blob/master/LICENSE.txt
|
12
|
+
*/
|
13
|
+
(function(factory) {
|
14
|
+
if (typeof exports === "object") {
|
15
|
+
factory(require("jquery"));
|
16
|
+
} else if (typeof define === "function" && define.amd) {
|
17
|
+
define(["jquery"], factory);
|
18
|
+
} else {
|
19
|
+
factory(jQuery);
|
20
|
+
}
|
21
|
+
}(function($) {
|
22
|
+
$.extend({ bez: function(encodedFuncName, coOrdArray) {
|
23
|
+
if ($.isArray(encodedFuncName)) {
|
24
|
+
coOrdArray = encodedFuncName;
|
25
|
+
encodedFuncName = 'bez_' + coOrdArray.join('_').replace(/\./g, 'p');
|
26
|
+
}
|
27
|
+
if (typeof $.easing[encodedFuncName] !== "function") {
|
28
|
+
var polyBez = function(p1, p2) {
|
29
|
+
var A = [null, null], B = [null, null], C = [null, null],
|
30
|
+
bezCoOrd = function(t, ax) {
|
31
|
+
C[ax] = 3 * p1[ax], B[ax] = 3 * (p2[ax] - p1[ax]) - C[ax], A[ax] = 1 - C[ax] - B[ax];
|
32
|
+
return t * (C[ax] + t * (B[ax] + t * A[ax]));
|
33
|
+
},
|
34
|
+
xDeriv = function(t) {
|
35
|
+
return C[0] + t * (2 * B[0] + 3 * A[0] * t);
|
36
|
+
},
|
37
|
+
xForT = function(t) {
|
38
|
+
var x = t, i = 0, z;
|
39
|
+
while (++i < 14) {
|
40
|
+
z = bezCoOrd(x, 0) - t;
|
41
|
+
if (Math.abs(z) < 1e-3) break;
|
42
|
+
x -= z / xDeriv(x);
|
43
|
+
}
|
44
|
+
return x;
|
45
|
+
};
|
46
|
+
return function(t) {
|
47
|
+
return bezCoOrd(xForT(t), 1);
|
48
|
+
}
|
49
|
+
};
|
50
|
+
$.easing[encodedFuncName] = function(x, t, b, c, d) {
|
51
|
+
return c * polyBez([coOrdArray[0], coOrdArray[1]], [coOrdArray[2], coOrdArray[3]])(t/d) + b;
|
52
|
+
}
|
53
|
+
}
|
54
|
+
return encodedFuncName;
|
55
|
+
}});
|
56
|
+
}));
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jquery-bez-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kirill
|
@@ -69,9 +69,12 @@ files:
|
|
69
69
|
- Rakefile
|
70
70
|
- bin/console
|
71
71
|
- bin/setup
|
72
|
+
- jquery-bez-rails-0.1.0.gem
|
72
73
|
- jquery-bez-rails.gemspec
|
73
74
|
- lib/jquery/bez/rails.rb
|
75
|
+
- lib/jquery/bez/rails/engine.rb
|
74
76
|
- lib/jquery/bez/rails/version.rb
|
77
|
+
- vendor/assets/javascripts/jquery.bez.js
|
75
78
|
homepage: https://github.com/cderche/jquery-bez-rails
|
76
79
|
licenses:
|
77
80
|
- MIT
|