-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/initial velocity directives #1
Changes from 5 commits
be61151
09fb5de
c8b3f63
c19c1e1
c761427
45cb470
e5e4369
06590c2
ce74bcf
02d18aa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
"use strict"; | ||
/** | ||
* Angular wrapper for velocityjs | ||
* @author SOON_ | ||
* @module sn.velocity.snVelocity | ||
* @class snVelocity | ||
* @example <sn-velocity data-keyframes="[{'properties': { opacity: 0 }, 'options': { duration: 1000 }},{'properties': { opacity: 1 },'options': { duration: 1000 }}]"></sn-velocity> | ||
*/ | ||
angular.module("sn.velocity.snVelocity", []).directive("snVelocity",[ | ||
/** | ||
* @constructor | ||
*/ | ||
function() { | ||
return { | ||
restrict: "A", | ||
scope: { | ||
"keyframes": "=" | ||
}, | ||
link: function($scope, $element){ | ||
|
||
angular.forEach($scope.keyframes, function(value){ | ||
Velocity($element, value.properties, value.options); | ||
}); | ||
|
||
} | ||
} | ||
} | ||
]); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
"use strict"; | ||
/** | ||
* @author SOON_ | ||
* @module sn.velocity.snVelocityGroup | ||
* @class snVelocityGroup | ||
* @example <sn-velocity-group data-keyframes=""></sn-velocity-group> | ||
*/ | ||
angular.module("sn.velocity.snVelocityGroup", [ | ||
"sn.velocity.snVelocity" | ||
]) | ||
|
||
.directive("snVelocityGroup",[ | ||
"$compile", | ||
"$rootScope", | ||
/** | ||
* @constructor | ||
* | ||
* @param {Service} $compile angular template compiler | ||
* @param {Object} $rootScope | ||
*/ | ||
function($compile, $rootScope) { | ||
return { | ||
restrict: "E", | ||
scope: { | ||
"keyframes": "=" | ||
}, | ||
link: function($scope, $element){ | ||
|
||
angular.forEach($scope.keyframes, function(keyframes, key){ | ||
var animateElement = angular.element($element[0].querySelector(key)); | ||
var scope = $rootScope.$new(); | ||
scope.keyframes = keyframes; | ||
|
||
animateElement.attr("sn-velocity", ""); | ||
animateElement.attr("data-keyframes", "keyframes"); | ||
|
||
$compile(animateElement)(scope); | ||
}); | ||
|
||
} | ||
} | ||
} | ||
]); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
"use strict"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here you could just use |
||
/** | ||
* Angular wrapper for velocityjs animation library | ||
* @requires velocityjs {@link https://github.com/julianshapiro/velocity} | ||
* @module sn.velocity | ||
* @author SOON_ | ||
*/ | ||
angular.module("sn.velocity", [ | ||
"sn.velocity.snVelocity", | ||
"sn.velocity.snVelocityGroup" | ||
]) |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's necessary to use namespace for filenames you can just call the files
velocity.js
andvelocity-group.js
http://stackoverflow.com/questions/7273316/what-is-the-javascript-filename-naming-convention