Created
October 10, 2013 19:40
-
-
Save sbosell/6924272 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var stickyInfo = { | |
width: 0, | |
height: 0, | |
index: 0, | |
nRows: 0, | |
nCols: 0, | |
nFrames: 0 | |
}; | |
scope.$watch('Animation', function (Animation) { | |
// cuando tengamos animacion, vamos a ininiarlo y lanzarlo | |
if (Animation) { | |
stickyInfo.nRows = Math.ceil(Animation.nframes / Animation.rframes); | |
stickyInfo.index = 0; | |
stickyInfo.nCols = Animation.rframes; | |
stickyInfo.nFrames = Animation.nframes; | |
stickyInfo.width = Animation.width / Animation.rframes; | |
stickyInfo.height = Animation.height / stickyInfo.nRows; | |
// ininicar la animacion | |
element.css({ | |
'backgroundPosition': '0 0', | |
'background-image': 'url(' + Animation.url + ')', | |
'width': stickyInfo.width + 'px', | |
'height': stickyInfo.height + 'px' | |
}); | |
scope.isAnimated = true; //queremos verlo animado siempre | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment