perspective as a function for better Firefox support

This commit is contained in:
Bartek Szopka
2012-03-07 23:50:29 +01:00
parent 7a7d3e7119
commit 811e045c60

View File

@@ -95,6 +95,10 @@
return " scale(" + s + ") "; return " scale(" + s + ") ";
}; };
var perspective = function ( p ) {
return " perspective(" + p + "px) ";
};
var getElementFromUrl = function () { var getElementFromUrl = function () {
// get id from url # by removing `#` or `#/` from the beginning, // get id from url # by removing `#` or `#/` from the beginning,
// so both `#slide-id` and "legacy" `#/slide-id` will work // so both `#slide-id` and "legacy" `#/slide-id` will work
@@ -179,7 +183,7 @@
css(root, { css(root, {
top: "50%", top: "50%",
left: "50%", left: "50%",
perspective: "1000px" transform: perspective(1000)
}); });
css(canvas, props); css(canvas, props);
@@ -304,8 +308,7 @@
css(root, { css(root, {
// to keep the perspective look similar for different scales // to keep the perspective look similar for different scales
// we need to 'scale' the perspective, too // we need to 'scale' the perspective, too
perspective: step.scale * (1/windowScale) * 1000 + "px", transform: perspective( 1000 / (target.scale * windowScale) ) + scale(target.scale * windowScale),
transform: scale(target.scale * windowScale),
transitionDuration: duration, transitionDuration: duration,
transitionDelay: (zoomin ? "500ms" : "0ms") transitionDelay: (zoomin ? "500ms" : "0ms")
}); });