/*Copyright 2015, Pall Thayer (http://pallthayer.dyndns.org)*/ /*These program are free software: you can redistribute them and/or modify them under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will rock your world, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see .*/ /*Objects in Motion III: Square with content flipping on two axes - 2017-10-08 12:39:53*/ var qpdb = function() { var count = 1; var width = window.innerWidth; var height = window.innerHeight; var thoughts = ['q', 'p', 'd', 'b']; var where = ['left', 'right', 'left', 'right']; var Ydeg = 180; var Xdeg = 180; var frame = document.createElement('div'); var youNeedMe = function() { frame.style.height = height*0.5+'px'; frame.style.width = height*0.5+'px'; frame.style['border-left'] = '5px solid #cca'; frame.style['border-top'] = '5px solid #ccb'; frame.style['border-right'] = '5px solid #ccc'; frame.style['border-bottom'] = '5px solid #ccd'; frame.style.margin = 'auto'; frame.id = 'needme'; makeThought(); } var makeThought = function() { frame.style['font-family'] = 'sans-serif'; frame.style['font-size'] = height*0.2+'px'; frame.style.padding = '10px'; var bubble = ''; for(var i=0;i < thoughts.length;i++) { bubble += '
'+thoughts[i]+'
'; if(i % 2 !== 0) { bubble += '
'; } } frame.innerHTML = bubble; document.body.appendChild(frame); for(var i = 1;i < 9999;i++) { window.clearInterval(i); } var grow = setInterval(function(){becoming();}, 1000); } var becoming = function() { switch(count) { case 1: Ydeg *= -1; frame.style.transform += 'rotateY('+Ydeg+'deg)'; break; case 2: Xdeg *= -1; frame.style.transform += 'rotateX('+Xdeg+'deg)'; break; case 3: Ydeg *= -1; frame.style.transform += 'rotateY('+Ydeg+'deg)'; break; case 4: Xdeg *= -1; frame.style.transform += 'rotateX('+Xdeg+'deg)'; break; default: break; } count = count == 4?1:count+1; } youNeedMe(); }