popcircle 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +13 -0
- data/LICENSE.txt +21 -0
- data/README.md +61 -0
- data/Rakefile +10 -0
- data/app/assets/javascripts/popcircle/popcircle.js.erb +19 -0
- data/app/assets/stylesheets/popcircle/popcircle.scss.erb +43 -0
- data/app/helpers/popcircle/rails/popcircle_helper.rb +55 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/popcircle.rb +2 -0
- data/lib/popcircle/engine.rb +26 -0
- data/lib/popcircle/version.rb +7 -0
- data/popcircle.gemspec +27 -0
- data/popcircle.gif +0 -0
- data/vendor/assets/images/big_round.png +0 -0
- data/vendor/assets/images/five.png +0 -0
- data/vendor/assets/images/four.png +0 -0
- data/vendor/assets/images/one.png +0 -0
- data/vendor/assets/images/three.png +0 -0
- data/vendor/assets/images/two.png +0 -0
- data/vendor/assets/javascripts/jquery.easing.js +166 -0
- data/vendor/assets/javascripts/jquery.popcircle.js +75 -0
- metadata +139 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 649a45aebd28ba28334d070736fb03f2af7db3df
|
4
|
+
data.tar.gz: 2d05345c7c542fc745a962427a2bb609de5650ad
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ffa464ef6d94af46886f63ab339f64cc2241d5b03bfe3a2ef1663e21391978e9d81918d527942cda48803de145a83501af7ca903795c01b9d68ce099b7fa6a3f
|
7
|
+
data.tar.gz: a98c3894e761a6c2f908dd32d9a9e7fc6485f37dcb5f9b8d88788dbbad827235473ea7ec53c6556170a30dfecb813af6147073c504ebb3424a935d1a64bb6fbd
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at jakehockey10@gmail.com. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in popcircle.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
group :development, :test do
|
7
|
+
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
8
|
+
gem 'byebug', platform: :mri
|
9
|
+
end
|
10
|
+
|
11
|
+
group :development do
|
12
|
+
gem 'pg'
|
13
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Jake Smith
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# Popcircle
|
2
|
+
|
3
|
+
![Alt text](/popcircle.gif)
|
4
|
+
|
5
|
+
This gem adds `jquery.easing` and `jquery.popcircle` to your application and provides a view helper to add a radial menu with images or icons as the links surrounding the main trigger.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'popcircle', github: 'jakehockey10/popcircle'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install popcircle
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
First, make sure your `application.js` file includes the following:
|
26
|
+
|
27
|
+
```javascript
|
28
|
+
//= require popcircle/popcircle
|
29
|
+
```
|
30
|
+
|
31
|
+
Second, you can include something like this in your `HTML`
|
32
|
+
|
33
|
+
```HTML
|
34
|
+
<%= popcircle(images: %w(one.png two.png three.png four.png five.png)) %>
|
35
|
+
```
|
36
|
+
|
37
|
+
## TODO
|
38
|
+
|
39
|
+
- More than one popcircle makes the click handler not work.
|
40
|
+
- Get helper tests back to running
|
41
|
+
- improve helper method
|
42
|
+
- allow trigger background image to be configurable
|
43
|
+
- allow size to be configurable
|
44
|
+
- make icons line up
|
45
|
+
|
46
|
+
## Contributing
|
47
|
+
|
48
|
+
I could use some help!
|
49
|
+
|
50
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/popcircle. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
51
|
+
|
52
|
+
## Development
|
53
|
+
|
54
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
55
|
+
|
56
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
57
|
+
|
58
|
+
## License
|
59
|
+
|
60
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
61
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
// app/assets/javascripts/popcircle.js
|
2
|
+
//
|
3
|
+
// jQuery Popcircle setup for popcircle helpers
|
4
|
+
//
|
5
|
+
//= require jquery.easing
|
6
|
+
//= require jquery.popcircle
|
7
|
+
|
8
|
+
$(document).on('turbolinks:load', function () {
|
9
|
+
$('.popcircle-trigger').click(function (e) {
|
10
|
+
e.preventDefault();
|
11
|
+
$.popcircle('#pops', {
|
12
|
+
spacing: '10px',
|
13
|
+
type: 'full', // full, half, quad
|
14
|
+
offset: 1.95, // 0, 1, 2, 3, 4, 5, 6, 7, or 5.1
|
15
|
+
ease: 'easeOutElastic',
|
16
|
+
time: 'slow' // slow, fast, 1000
|
17
|
+
});
|
18
|
+
});
|
19
|
+
});
|
@@ -0,0 +1,43 @@
|
|
1
|
+
@import 'font-awesome';
|
2
|
+
|
3
|
+
.popcircle-box {
|
4
|
+
width: 500px;
|
5
|
+
height: 500px;
|
6
|
+
float: left;
|
7
|
+
}
|
8
|
+
|
9
|
+
.popcircle-trigger {
|
10
|
+
width: 255px;
|
11
|
+
height: 255px;
|
12
|
+
position: relative;
|
13
|
+
z-index: 10;
|
14
|
+
left: 110px;
|
15
|
+
top: 110px;
|
16
|
+
background-image: url(<%= asset_url('big_round.png') %>);
|
17
|
+
cursor: pointer;
|
18
|
+
}
|
19
|
+
|
20
|
+
.popcircle {
|
21
|
+
position: relative;
|
22
|
+
z-index: 9;
|
23
|
+
width: 500px;
|
24
|
+
height: 500px;
|
25
|
+
left: 0px;
|
26
|
+
top: -250px;
|
27
|
+
}
|
28
|
+
|
29
|
+
.popcircle ul {
|
30
|
+
list-style: none;
|
31
|
+
padding: 0px;
|
32
|
+
margin: 0px;
|
33
|
+
height: auto;
|
34
|
+
cursor: pointer;
|
35
|
+
}
|
36
|
+
|
37
|
+
.popcircle ul li {
|
38
|
+
top: 187.5px;
|
39
|
+
left: 187.5px;
|
40
|
+
height: 100px;
|
41
|
+
width: 100px;
|
42
|
+
position: absolute;
|
43
|
+
}
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module Popcircle
|
2
|
+
module Rails
|
3
|
+
module PopcircleHelper
|
4
|
+
include ActionView::Helpers::TagHelper
|
5
|
+
include FontAwesome::Rails::IconHelper
|
6
|
+
|
7
|
+
def popcircle(circles, options = {})
|
8
|
+
# options = circles.length > 1 ? circles.extract_options! : {}
|
9
|
+
raise Exception.new('Argument `circles` not a Hash...') unless circles.is_a? Hash
|
10
|
+
|
11
|
+
if circles[:icons]
|
12
|
+
circles = circles[:icons].map { |circle| { icon: circle } }
|
13
|
+
elsif circles[:images]
|
14
|
+
circles = circles[:images].map { |circle| { image: circle } }
|
15
|
+
end
|
16
|
+
options[:list] ||= 'pops'
|
17
|
+
content_tag :div, class: 'popcircle-box' do
|
18
|
+
trigger + list(circles, options)
|
19
|
+
end if circles
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def trigger
|
25
|
+
content_tag :div, '', class: 'popcircle-trigger'
|
26
|
+
end
|
27
|
+
|
28
|
+
def list(circles, options)
|
29
|
+
content_tag :div, class: 'popcircle' do
|
30
|
+
content_tag :ul, id: options[:list] do
|
31
|
+
circles.each do |circle|
|
32
|
+
concat list_item(circle)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def list_item(circle)
|
39
|
+
content_tag :li, link_with_image_or_icon(circle).html_safe
|
40
|
+
end
|
41
|
+
|
42
|
+
def link_with_image_or_icon(circle)
|
43
|
+
link_to (circle[:link] ||= '') do
|
44
|
+
if circle[:image]
|
45
|
+
image_tag circle[:image]
|
46
|
+
elsif circle[:icon]
|
47
|
+
fa_icon "#{circle[:icon]} 2x"
|
48
|
+
else
|
49
|
+
'UH OH'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'popcircle'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require 'irb'
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/lib/popcircle.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'font-awesome-rails'
|
2
|
+
require 'rails'
|
3
|
+
|
4
|
+
module Popcircle
|
5
|
+
module Rails
|
6
|
+
class Railtie < ::Rails::Railtie
|
7
|
+
end
|
8
|
+
class Engine < ::Rails::Engine
|
9
|
+
initializer 'popcircle.assets.precompile' do |app|
|
10
|
+
app.config.assets.precompile += %w(
|
11
|
+
big_round.png
|
12
|
+
one.png
|
13
|
+
two.png
|
14
|
+
three.png
|
15
|
+
four.png
|
16
|
+
five.png
|
17
|
+
)
|
18
|
+
end
|
19
|
+
initializer 'popcircle.action_view' do
|
20
|
+
ActiveSupport.on_load :action_view do
|
21
|
+
include FontAwesome::Rails::IconHelper
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/popcircle.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'popcircle/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'popcircle'
|
8
|
+
spec.version = Popcircle::Rails::VERSION
|
9
|
+
spec.authors = ['Jake Smith']
|
10
|
+
spec.email = ['jakehockey10@gmail.com']
|
11
|
+
|
12
|
+
spec.summary = %q{Adds the popcircle jquery plugin into the rails asset pipeline.}
|
13
|
+
spec.homepage = 'https://github.com/jakehockey10/popcircle'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = 'exe'
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_dependency 'rails', '~> 5.0'
|
22
|
+
spec.add_dependency 'font-awesome-rails'
|
23
|
+
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.12'
|
25
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
26
|
+
spec.add_development_dependency 'minitest', '~> 5.0'
|
27
|
+
end
|
data/popcircle.gif
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,166 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery Easing v1.4.0 - http://gsgd.co.uk/sandbox/jquery/easing/
|
3
|
+
* Open source under the BSD License.
|
4
|
+
* Copyright © 2008 George McGinley Smith
|
5
|
+
* All rights reserved.
|
6
|
+
* https://raw.github.com/gdsmith/jquery-easing/master/LICENSE
|
7
|
+
*/
|
8
|
+
|
9
|
+
(function (factory) {
|
10
|
+
if (typeof define === "function" && define.amd) {
|
11
|
+
define(['jquery'], function ($) {
|
12
|
+
return factory($);
|
13
|
+
});
|
14
|
+
} else if (typeof module === "object" && typeof module.exports === "object") {
|
15
|
+
exports = factory(require('jquery'));
|
16
|
+
} else {
|
17
|
+
factory(jQuery);
|
18
|
+
}
|
19
|
+
})(function($){
|
20
|
+
|
21
|
+
// Preserve the original jQuery "swing" easing as "jswing"
|
22
|
+
$.easing['jswing'] = $.easing['swing'];
|
23
|
+
|
24
|
+
var pow = Math.pow,
|
25
|
+
sqrt = Math.sqrt,
|
26
|
+
sin = Math.sin,
|
27
|
+
cos = Math.cos,
|
28
|
+
PI = Math.PI,
|
29
|
+
c1 = 1.70158,
|
30
|
+
c2 = c1 * 1.525,
|
31
|
+
c3 = c1 + 1,
|
32
|
+
c4 = ( 2 * PI ) / 3,
|
33
|
+
c5 = ( 2 * PI ) / 4.5;
|
34
|
+
|
35
|
+
// x is the fraction of animation progress, in the range 0..1
|
36
|
+
function bounceOut(x) {
|
37
|
+
var n1 = 7.5625,
|
38
|
+
d1 = 2.75;
|
39
|
+
if ( x < 1/d1 ) {
|
40
|
+
return n1*x*x;
|
41
|
+
} else if ( x < 2/d1 ) {
|
42
|
+
return n1*(x-=(1.5/d1))*x + .75;
|
43
|
+
} else if ( x < 2.5/d1 ) {
|
44
|
+
return n1*(x-=(2.25/d1))*x + .9375;
|
45
|
+
} else {
|
46
|
+
return n1*(x-=(2.625/d1))*x + .984375;
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
$.extend( $.easing,
|
51
|
+
{
|
52
|
+
def: 'easeOutQuad',
|
53
|
+
swing: function (x) {
|
54
|
+
return $.easing[$.easing.def](x);
|
55
|
+
},
|
56
|
+
easeInQuad: function (x) {
|
57
|
+
return x * x;
|
58
|
+
},
|
59
|
+
easeOutQuad: function (x) {
|
60
|
+
return 1 - ( 1 - x ) * ( 1 - x );
|
61
|
+
},
|
62
|
+
easeInOutQuad: function (x) {
|
63
|
+
return x < 0.5 ?
|
64
|
+
2 * x * x :
|
65
|
+
1 - pow( -2 * x + 2, 2 ) / 2;
|
66
|
+
},
|
67
|
+
easeInCubic: function (x) {
|
68
|
+
return x * x * x;
|
69
|
+
},
|
70
|
+
easeOutCubic: function (x) {
|
71
|
+
return 1 - pow( 1 - x, 3 );
|
72
|
+
},
|
73
|
+
easeInOutCubic: function (x) {
|
74
|
+
return x < 0.5 ?
|
75
|
+
4 * x * x * x :
|
76
|
+
1 - pow( -2 * x + 2, 3 ) / 2;
|
77
|
+
},
|
78
|
+
easeInQuart: function (x) {
|
79
|
+
return x * x * x * x;
|
80
|
+
},
|
81
|
+
easeOutQuart: function (x) {
|
82
|
+
return 1 - pow( 1 - x, 4 );
|
83
|
+
},
|
84
|
+
easeInOutQuart: function (x) {
|
85
|
+
return x < 0.5 ?
|
86
|
+
8 * x * x * x * x :
|
87
|
+
1 - pow( -2 * x + 2, 4 ) / 2;
|
88
|
+
},
|
89
|
+
easeInQuint: function (x) {
|
90
|
+
return x * x * x * x * x;
|
91
|
+
},
|
92
|
+
easeOutQuint: function (x) {
|
93
|
+
return 1 - pow( 1 - x, 5 );
|
94
|
+
},
|
95
|
+
easeInOutQuint: function (x) {
|
96
|
+
return x < 0.5 ?
|
97
|
+
16 * x * x * x * x * x :
|
98
|
+
1 - pow( -2 * x + 2, 5 ) / 2;
|
99
|
+
},
|
100
|
+
easeInSine: function (x) {
|
101
|
+
return 1 - cos( x * PI/2 );
|
102
|
+
},
|
103
|
+
easeOutSine: function (x) {
|
104
|
+
return sin( x * PI/2 );
|
105
|
+
},
|
106
|
+
easeInOutSine: function (x) {
|
107
|
+
return -( cos( PI * x ) - 1 ) / 2;
|
108
|
+
},
|
109
|
+
easeInExpo: function (x) {
|
110
|
+
return x === 0 ? 0 : pow( 2, 10 * x - 10 );
|
111
|
+
},
|
112
|
+
easeOutExpo: function (x) {
|
113
|
+
return x === 1 ? 1 : 1 - pow( 2, -10 * x );
|
114
|
+
},
|
115
|
+
easeInOutExpo: function (x) {
|
116
|
+
return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ?
|
117
|
+
pow( 2, 20 * x - 10 ) / 2 :
|
118
|
+
( 2 - pow( 2, -20 * x + 10 ) ) / 2;
|
119
|
+
},
|
120
|
+
easeInCirc: function (x) {
|
121
|
+
return 1 - sqrt( 1 - pow( x, 2 ) );
|
122
|
+
},
|
123
|
+
easeOutCirc: function (x) {
|
124
|
+
return sqrt( 1 - pow( x - 1, 2 ) );
|
125
|
+
},
|
126
|
+
easeInOutCirc: function (x) {
|
127
|
+
return x < 0.5 ?
|
128
|
+
( 1 - sqrt( 1 - pow( 2 * x, 2 ) ) ) / 2 :
|
129
|
+
( sqrt( 1 - pow( -2 * x + 2, 2 ) ) + 1 ) / 2;
|
130
|
+
},
|
131
|
+
easeInElastic: function (x) {
|
132
|
+
return x === 0 ? 0 : x === 1 ? 1 :
|
133
|
+
-pow( 2, 10 * x - 10 ) * sin( ( x * 10 - 10.75 ) * c4 );
|
134
|
+
},
|
135
|
+
easeOutElastic: function (x) {
|
136
|
+
return x === 0 ? 0 : x === 1 ? 1 :
|
137
|
+
pow( 2, -10 * x ) * sin( ( x * 10 - 0.75 ) * c4 ) + 1;
|
138
|
+
},
|
139
|
+
easeInOutElastic: function (x) {
|
140
|
+
return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ?
|
141
|
+
-( pow( 2, 20 * x - 10 ) * sin( ( 20 * x - 11.125 ) * c5 )) / 2 :
|
142
|
+
pow( 2, -20 * x + 10 ) * sin( ( 20 * x - 11.125 ) * c5 ) / 2 + 1;
|
143
|
+
},
|
144
|
+
easeInBack: function (x) {
|
145
|
+
return c3 * x * x * x - c1 * x * x;
|
146
|
+
},
|
147
|
+
easeOutBack: function (x) {
|
148
|
+
return 1 + c3 * pow( x - 1, 3 ) + c1 * pow( x - 1, 2 );
|
149
|
+
},
|
150
|
+
easeInOutBack: function (x) {
|
151
|
+
return x < 0.5 ?
|
152
|
+
( pow( 2 * x, 2 ) * ( ( c2 + 1 ) * 2 * x - c2 ) ) / 2 :
|
153
|
+
( pow( 2 * x - 2, 2 ) *( ( c2 + 1 ) * ( x * 2 - 2 ) + c2 ) + 2 ) / 2;
|
154
|
+
},
|
155
|
+
easeInBounce: function (x) {
|
156
|
+
return 1 - bounceOut( 1 - x );
|
157
|
+
},
|
158
|
+
easeOutBounce: bounceOut,
|
159
|
+
easeInOutBounce: function (x) {
|
160
|
+
return x < 0.5 ?
|
161
|
+
( 1 - bounceOut( 1 - 2 * x ) ) / 2 :
|
162
|
+
( 1 + bounceOut( 2 * x - 1 ) ) / 2;
|
163
|
+
}
|
164
|
+
});
|
165
|
+
|
166
|
+
});
|
@@ -0,0 +1,75 @@
|
|
1
|
+
(function($){
|
2
|
+
$.popcircle = function(selector, settings){
|
3
|
+
var config = {
|
4
|
+
'spacing':'10px',
|
5
|
+
'count':5,
|
6
|
+
'type':'full',
|
7
|
+
'offset':0,
|
8
|
+
'ease':'easeOutQuad',
|
9
|
+
'time':'slow'
|
10
|
+
};
|
11
|
+
if (settings){$.extend(config, settings);}
|
12
|
+
var obj = $(selector);
|
13
|
+
var trig_width=parseInt($(selector).parent().siblings().css('width'));
|
14
|
+
var trig_height=parseInt($(selector).parent().siblings().css('height'));
|
15
|
+
var trig_left=parseInt($(selector).parent().siblings().css('left'));
|
16
|
+
var trig_top=parseInt($(selector).parent().siblings().css('top'));
|
17
|
+
var child_width=parseInt($(selector).children('li').css('width'));
|
18
|
+
var child_height=parseInt($(selector).children('li').css('height'));
|
19
|
+
var con_left=((trig_width/2)-(child_width/2)+trig_left)+'px';
|
20
|
+
var con_top=((trig_height/2)-(child_height/2)+trig_top)+'px';
|
21
|
+
var spacing=parseInt(config.spacing);
|
22
|
+
|
23
|
+
var li = obj.children('li');
|
24
|
+
var count = li.length;
|
25
|
+
var inc=0;
|
26
|
+
$.each( li, function( key, value ) {
|
27
|
+
var cls=$(this).attr('class');
|
28
|
+
var top=$(this).css('top');
|
29
|
+
var left=$(this).css('left');
|
30
|
+
if(con_left==left&&con_top==top)
|
31
|
+
{
|
32
|
+
|
33
|
+
switch (config.type)
|
34
|
+
{
|
35
|
+
case 'full':
|
36
|
+
|
37
|
+
var cnt=360/count;
|
38
|
+
var rd=((cnt * (Math.PI/180))*key);
|
39
|
+
var x=parseInt(con_left)+((parseInt(con_left)+spacing)*Math.cos(rd));
|
40
|
+
var y=parseInt(con_top)+((parseInt(con_top)+spacing)*Math.sin(rd));
|
41
|
+
|
42
|
+
|
43
|
+
break;
|
44
|
+
case 'half':
|
45
|
+
var cnt=180/count;
|
46
|
+
|
47
|
+
var rd=((cnt * (Math.PI/180))*key)+config.offset;
|
48
|
+
var x=parseInt(con_left)+((parseInt(con_left)+spacing)*Math.cos(rd));
|
49
|
+
var y=parseInt(con_top)+((parseInt(con_top)+spacing)*Math.sin(rd));
|
50
|
+
|
51
|
+
|
52
|
+
break;
|
53
|
+
case 'quad':
|
54
|
+
var cnt=90/count;
|
55
|
+
|
56
|
+
var rd=((cnt * (Math.PI/180))*key)+config.offset;
|
57
|
+
var x=parseInt(con_left)+((parseInt(con_left)+spacing)*Math.cos(rd));
|
58
|
+
var y=parseInt(con_top)+((parseInt(con_top)+spacing)*Math.sin(rd));
|
59
|
+
|
60
|
+
break;
|
61
|
+
}
|
62
|
+
|
63
|
+
$(this).animate({ top: y,left:x }, {duration: config.time,easing: config.ease});
|
64
|
+
|
65
|
+
}
|
66
|
+
else
|
67
|
+
{
|
68
|
+
$(this).animate({ top: con_top,left:con_left }, {duration: config.time,easing: config.ease});
|
69
|
+
}
|
70
|
+
|
71
|
+
});
|
72
|
+
return this;
|
73
|
+
|
74
|
+
};
|
75
|
+
})(jQuery);
|
metadata
ADDED
@@ -0,0 +1,139 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: popcircle
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jake Smith
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-07-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '5.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: font-awesome-rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.12'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.12'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: minitest
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '5.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '5.0'
|
83
|
+
description:
|
84
|
+
email:
|
85
|
+
- jakehockey10@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".travis.yml"
|
92
|
+
- CODE_OF_CONDUCT.md
|
93
|
+
- Gemfile
|
94
|
+
- LICENSE.txt
|
95
|
+
- README.md
|
96
|
+
- Rakefile
|
97
|
+
- app/assets/javascripts/popcircle/popcircle.js.erb
|
98
|
+
- app/assets/stylesheets/popcircle/popcircle.scss.erb
|
99
|
+
- app/helpers/popcircle/rails/popcircle_helper.rb
|
100
|
+
- bin/console
|
101
|
+
- bin/setup
|
102
|
+
- lib/popcircle.rb
|
103
|
+
- lib/popcircle/engine.rb
|
104
|
+
- lib/popcircle/version.rb
|
105
|
+
- popcircle.gemspec
|
106
|
+
- popcircle.gif
|
107
|
+
- vendor/assets/images/big_round.png
|
108
|
+
- vendor/assets/images/five.png
|
109
|
+
- vendor/assets/images/four.png
|
110
|
+
- vendor/assets/images/one.png
|
111
|
+
- vendor/assets/images/three.png
|
112
|
+
- vendor/assets/images/two.png
|
113
|
+
- vendor/assets/javascripts/jquery.easing.js
|
114
|
+
- vendor/assets/javascripts/jquery.popcircle.js
|
115
|
+
homepage: https://github.com/jakehockey10/popcircle
|
116
|
+
licenses:
|
117
|
+
- MIT
|
118
|
+
metadata: {}
|
119
|
+
post_install_message:
|
120
|
+
rdoc_options: []
|
121
|
+
require_paths:
|
122
|
+
- lib
|
123
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '0'
|
128
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
requirements: []
|
134
|
+
rubyforge_project:
|
135
|
+
rubygems_version: 2.6.6
|
136
|
+
signing_key:
|
137
|
+
specification_version: 4
|
138
|
+
summary: Adds the popcircle jquery plugin into the rails asset pipeline.
|
139
|
+
test_files: []
|