Created
December 12, 2012 16:20
-
-
Save daithiocrualaoich/4269195 to your computer and use it in GitHub Desktop.
Circular impress.js slide layout in Javascript
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
var steps = document.getElementsByClassName("step"); | |
var r = 2000; | |
for (var i = 0; i < steps.length; i++) { | |
var theta = -i/(steps.length-1) * 2 * Math.PI; | |
var x = r * Math.cos(theta); | |
var y = r * Math.sin(theta); | |
var rotation = theta/(2*Math.PI) * 360 - 90; | |
steps[i].setAttribute("data-x", Math.round(x).toString()); | |
steps[i].setAttribute("data-y", Math.round(y).toString()); | |
steps[i].setAttribute("data-rotate-z", Math.round(rotation).toString()); | |
} | |
var overview = document.getElementById("overview"); | |
overview.setAttribute("data-x", "0"); | |
overview.setAttribute("data-y", "0"); | |
overview.setAttribute("data-scale", "5"); | |
// Disable click to move to step. | |
document.addEventListener("click", function() { event.cancelBubble = true; }, true); | |
impress().init(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment