0
我制作了Adobe Edge动画。 现在我想将动画和预加载器居中,所以总是显示 horizonaly和verticaly集中在我的浏览器中。中心adobe edge动画舞台和预加载器水平和垂直
请帮帮我。
我发现下面的线索: http://forums.adobe.com/thread/979124?promoid=KBHBD
但没有什么对我的作品。
我制作了Adobe Edge动画。 现在我想将动画和预加载器居中,所以总是显示 horizonaly和verticaly集中在我的浏览器中。中心adobe edge动画舞台和预加载器水平和垂直
请帮帮我。
我发现下面的线索: http://forums.adobe.com/thread/979124?promoid=KBHBD
但没有什么对我的作品。
我使用下面的代码来居中和调整舞台大小,使它适合窗口。 如果您不想调整大小,但只是居中,则可以简单地删除大小调整部分。 您可以将此代码粘贴到舞台组件的window.resize事件(窗口>代码>舞台>事件>调整大小)。
var stageHeight = $("#Stage").height();
var stageWidth = $("#Stage").width();
// console.log("stageHeight " + stageHeight);
// console.log("stageWidth " + stageWidth);
var ratio = stageWidth/stageHeight;
var bodyHeight = $(window).height();
var bodyWidth = $(window).width();
// console.log("bodyHeight " + bodyHeight);
// console.log("bodyWidth " + bodyWidth);
var bodyRatio = bodyWidth/bodyHeight;
var newStageHeight = bodyHeight;
var newStageWidth = bodyWidth;
var leftPos = 0;
var topPos = 0;
// fit width
if (bodyRatio < ratio) {
newStageWidth = bodyWidth;
newStageHeight = newStageWidth/ratio;
topPos = 0.5 * (bodyHeight - newStageHeight);
}
// fit height
else if (ratio < bodyRatio) {
newStageHeight = bodyHeight;
newStageWidth = newStageHeight * ratio;
leftPos = 0.5 * (bodyWidth - newStageWidth);
}
// console.log("newStageHeight " + newStageHeight);
// console.log("newStageWidth " + newStageWidth);
$("#Stage").height(newStageHeight);
$("#Stage").width(newStageWidth);
$("#Stage").css("left", leftPos + 'px');
$("#Stage").css("top", topPos + 'px');
嗨Ena, 感谢您的评论 - 但它不适用于我。 请看看下面的testpage从我: http://openoffice.funpic.de/Test_002/test002.html 您可以下载完整的组成(包括边缘动画源文件): http://openoffice.funpic.de/Test_002/Test_002.rar – Ronny
如果您调整浏览器窗口的大小,您将看到代码实际工作:]唯一的问题是,页面加载时事件未被触发。请将完全相同的代码添加到事件compositionReady(“窗口”>“代码”>“舞台”>“事件”>“组合准备”)。 – Ena
嗨 - 是的 - 我试过这个: 它只是缩进,但不是水平居中的 它仍然在页面的顶部。 你可以看看这个版本的我的测试: http://openoffice.funpic.de/Test_004/test004.html http://openoffice.funpic.de/Test_004/Test_004.rar 也请拿看看版本003 .....我尝试了另一个代码,这完全适用于Firefox(水平和垂直居中),但不是与Internet Explorer :( – Ronny