Skip to content

Instantly share code, notes, and snippets.

@sbosell
Created October 10, 2013 19:40
Show Gist options
  • Save sbosell/6924272 to your computer and use it in GitHub Desktop.
Save sbosell/6924272 to your computer and use it in GitHub Desktop.
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