Created
April 10, 2012 10:24
-
-
Save lqez/2350170 to your computer and use it in GitHub Desktop.
kenburn random function for jquery.cross-slide.js
This file contains 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
function kenburn_random( force_zoom ) | |
{ | |
var xpos = Math.floor(Math.random() * 100); | |
var ypos = Math.floor(Math.random() * 100); | |
var zoom = (Math.random()*3); | |
if( zoom < 1.0 || force_zoom == 1 ) zoom = 1.0; | |
return xpos+'% '+ypos+'% '+zoom+'x'; | |
} | |
/* usage | |
function slideStart() | |
{ | |
$('#image-slide').crossSlide({ | |
fade: 1 | |
}, [ | |
{ src: 'sample1.jpg', | |
from: kenburn_random(1), | |
to: kenburn_random(0), | |
time: Math.floor(Math.random()*4+4) }, | |
{ src: 'sample2.jpg', | |
from: kenburn_random(0), | |
to: kenburn_random(1), | |
time: Math.floor(Math.random()*4+4) } | |
]); | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment