-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 04b904e
Showing
10 changed files
with
722 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/*global module:false*/ | ||
module.exports = function(grunt) { | ||
|
||
// Project configuration. | ||
grunt.initConfig({ | ||
pkg: grunt.file.readJSON('package.json'), | ||
|
||
meta: { | ||
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + | ||
'<%= grunt.template.today("yyyy-mm-dd") + "\\n" %>' + | ||
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' + | ||
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' + | ||
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n\n' | ||
}, | ||
|
||
uglify: { | ||
options: { | ||
// the banner is inserted at the top of the output | ||
banner: "<%= meta.banner %>" | ||
}, | ||
dist: { | ||
files: { | ||
'dist/<%= pkg.name %>.min.js': [ '<%= pkg.name %>.js' ] | ||
} | ||
} | ||
}, | ||
}); | ||
|
||
// Dependencies | ||
grunt.loadNpmTasks('grunt-contrib-uglify'); | ||
|
||
// Default task. | ||
grunt.registerTask('default', 'uglify'); | ||
// grunt.registerTask('deploy', ['uglify', 'concat']); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Copyright (c) 2015 Kushagra Gour, http://kushagragour.in | ||
|
||
Permission is hereby granted, free of charge, to any person | ||
obtaining a copy of this software and associated documentation | ||
files (the "Software"), to deal in the Software without | ||
restriction, including without limitation the rights to use, | ||
copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the | ||
Software is furnished to do so, subject to the following | ||
conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
cta.css | ||
===== | ||
*It a call to animate, anything to anything* | ||
*** | ||
|
||
cta.js or "Call to Animation" is a light-weight performant library to animate any element onto any other element on the page. | ||
|
||
### [Demo](http://kushagragour.in/lab/ctajs). | ||
|
||
Installation | ||
----- | ||
|
||
``` | ||
bower install ctajs | ||
``` | ||
*or* | ||
|
||
``` | ||
npm install ctajs | ||
``` | ||
|
||
*or* simply [download from Github](https://github.com/chinchang/cta.js/blob/master/cta.min.js). | ||
|
||
Usage | ||
----- | ||
|
||
In very basic form, you can animate an element with selector X to an element with selector Y: | ||
|
||
```js | ||
var e1 = document.querySelector(X), | ||
e2 = document.querySelector(Y); | ||
cta(e1, e2); | ||
``` | ||
|
||
Triggering a reverse animation; | ||
|
||
```js | ||
var e1 = document.querySelector('#js-element-from'), | ||
e2 = document.querySelector('#js-element-to'); | ||
var reverseAnimate = cta(e1, e2); | ||
|
||
// Reverse previous animation | ||
reverseAnimate(); | ||
``` | ||
|
||
Specify animation duration: | ||
|
||
```js | ||
var e1 = document.querySelector('#js-element-from'), | ||
e2 = document.querySelector('#js-element-to'); | ||
cta(e1, e2, { | ||
duration: 0.3 // seconds | ||
}); | ||
``` | ||
|
||
Specify a callback to execute after animation: | ||
|
||
```js | ||
var button = document.querySelector('#js-button'), | ||
hiddenModal = document.querySelector('#js-modal'); | ||
cta(button, hiddenModal, function () { | ||
showModal(); | ||
}); | ||
``` | ||
More documentation coming up. | ||
|
||
Public API | ||
----- | ||
|
||
### cta(fromElement, toElement [, options] [, callback] ) | ||
|
||
Animate an element `fromElement` onto `toElement`. | ||
|
||
* `fromElement` - DOM Element which is the starting point of animation. | ||
* `toElement` - DOM Element which is the end point of animation. | ||
* `options` - A map of additional options to control the animation behaviour. | ||
* `duration` - Duration (in seconds) of animation. Default is `0.3` seconds. | ||
* `targetShowDuration` - Duration (in seconds) of `toElement` to become visible, if hidden initially. The library will automatically try to figure this out from the element's computed styles. Default is `0` seconds. | ||
* `relativeToWindow` - Set to true if you want animation to happen relative to window (with fixed positioned elements). Default is relative to document (absolute positioned). | ||
* `callback` - Optional callback to execute after animation completes. | ||
|
||
|
||
Browser Support | ||
----- | ||
|
||
**cta.js** works on Google Chrome only currently. Firefox support is under development. | ||
|
||
Contributing | ||
----- | ||
|
||
Interested in contributing features and fixes? | ||
|
||
[Read more on contributing](./CONTRIBUTING.md). | ||
|
||
Changelog | ||
----- | ||
|
||
See the [Changelog](https://github.com/chinchang/cta.js/wiki/Changelog) | ||
|
||
License | ||
----- | ||
|
||
Copyright (c) 2015 Kushagra Gour, http://kushagragour.in | ||
Licensed under the [MIT license](http://opensource.org/licenses/MIT). | ||
|
||
Credits | ||
----- | ||
|
||
Paul Lewis - for this awesome performance tip on scaling elements. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "cta.js", | ||
"version": "0.0.1", | ||
"main": "cta.min.js", | ||
"author": "Kushagra Gour", | ||
"ignore": [ | ||
"CONTRIBUTING.md", | ||
"Gruntfile.js" | ||
], | ||
"keywords": [ | ||
"animation", | ||
"transition", | ||
"ux" | ||
] | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.