Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding width & height options

  • Loading branch information...
commit 65104b56c37ea974dbe6267e44ccd4065e164ecd 1 parent 86a9bd1
@darsain authored
Showing with 6 additions and 6 deletions.
  1. +6 −6 src/motio.js
View
12 src/motio.js
@@ -51,13 +51,11 @@
var callbacks = {};
var animation = {};
var active = 0;
- var width = frame.clientWidth;
- var height = frame.clientHeight;
var pos, bgPos, lastPos, frameID, renderID, i, l;
// Exposed properties
- self.width = width;
- self.height = height;
+ self.width = o.width || frame.clientWidth;
+ self.height = o.height || frame.clientHeight;
self.options = o;
self.isPaused = 1;
@@ -432,9 +430,9 @@
frames.length = 0;
for (var i = 0; i < o.frames; i++) {
if (o.vertical) {
- pos.y = i * -height;
+ pos.y = i * -self.height;
} else {
- pos.x = i * -width;
+ pos.x = i * -self.width;
}
frames.push(pos.x + 'px ' + pos.y + 'px');
}
@@ -507,6 +505,8 @@
// Sprite animation specific options
frames: 0, // Number of frames in sprite.
vertical: 0, // Tells Motio that you are using vertically stacked sprite image.
+ width: 0, // Set the frame width manually (optional).
+ height: 0, // Set the frame height manually (optional).
// Panning specific options
speedX: 0, // Horizontal panning speed in pixels per second.
Please sign in to comment.
Something went wrong with that request. Please try again.