Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,28 @@ $('YOUR-CSS-SELECTOR').solitaireVictory();
**With Options:** (*defaults listed*)
```
$('YOUR-CSS-SELECTOR').solitaireVictory({

// PHYSICS PROPERTIES
g: -3 // Gravity. Must be less than 0; closer to 0 is weaker.

dt: 20 // Time between frames, in milliseconds.

bounce: 0.7 // Amount of speed conserved on bounce.

endVelocity: 20 // If the element is slower than this, it will not bounce.

fallToLeft: false // If set to true, the object will fall to the left instead
// of to the right


fallToLeft: false // If set to 'random', the object will have a 50% chance of falling
// left or right
// If set to true, the object will always fall to the left
// If set to false, the object will always fall to the right


// PAGE CONFIGURATION
clear: false // Clears the debris from past victories before starting.

stagger: 200 // If multiple DOM elements are selected, staggers the starts
// by this amount. If set to 0, all elements start at the same time.

relativeToDocument: false // If set to true, the object will bounce at the bottom of the
// document instead of the bottom of the window. This can solve
// some issues on longer documents, but looks worse in general.
Expand Down
9 changes: 7 additions & 2 deletions solitaireVictory.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@

var startFall = function(elem, height, stagger) {
var dx = settings.dx || Math.floor((Math.random()*10)) + 5;
if (fallToLeft) {
if (fallToLeft == 'random') {
// Falls left 50% of the time
if (Math.random() >= 0.5) {
dx = -dx;
}
} else if (fallToLeft) {
dx = -dx;
}
var copy = elem.clone();
Expand Down Expand Up @@ -71,4 +76,4 @@
});
};

}( jQuery ));
}( jQuery ));