📄 script.js
字号:
t.m_build=0;
t.m_dId="";
t.m_aAct=0;
t.m_secs=-1;
t.m_order=0;
t.m_sound="";
t.m_oldc=0;
t.m_video="";
t.m_animObj=0;
t.m_timer=-1;
t.m_steps=0;
t.m_finalL=0;
t.m_finalT=0;
t.m_finalW=0;
t.m_finalH=0;
t.Start=A_Start;
t.End=A_End;
t.Animate=A_Animate;
t.SetupMove=A_SetupMove;
t.DoMove=A_DoMove;
t.DoSpiral=A_DoSpiral;
t.DoSwivel=A_DoSwivel;
t.DoInplace=A_DoInplace;
}
function TickHandler(){
if(null != g_curAnim) g_curAnim.Animate();
}
function GetAnimClass(dir){
if(dir > 99) return 7;
else if(dir > 28) return 5;
else if(dir == 27) return 4;
else if(dir == 28) return 3;
else if((dir >= 12) && (dir < 16))return 2;
else return 1;
}
function GetSteps(dir){
animClass =GetAnimClass(dir);
if(animClass == 5 || animClass == 7) return 1;
res=12;
if(animClass >= 2 && animClass <= 4) res = 50;
if(SlideObj.style.backgroundImage != "") res /= 2;
return res;
}
function A_Start(){
g_curAnim = this;
this.SetupMove();
if(this.m_sound)
PlaySound(this.m_sound, false);
animClass =GetAnimClass(this.m_build);
if(5 == animClass)
this.DoInplace();
else {
this.m_animObj.style.visibility = "visible";
time = 0;
if(7 == animClass) { // Appear and flash
switch(this.m_build) {
case 100: time = 300; break;
case 101:
case 200: time = 500; break;
case 102: time = 1000; break;
}
if(this.m_build < 200)
this.m_aAct = AE_HIDEIMDTLY;
}
else
time =(animClass % 2 == 0) ? LONG_INTERVAL : SHORT_INTERVAL;
this.m_timer =window.setInterval("TickHandler()", time);
}
}
function A_End(){
window.clearInterval(this.m_timer);
if(this.m_video != "")
PlayMedia(this.m_video);
rStyle = this.m_obj.style;
if(this.m_dId == ""){
rStyle.pixelLeft =this.m_finalL;
rStyle.pixelTop =this.m_finalT;
rStyle.pixelWidth =this.m_finalW;
rStyle.pixelHeight =this.m_finalH;
}
else {
if(this.m_aAct != AE_HIDEIMDTLY)
rStyle.visibility = "visible";
this.m_animObj.style.visibility = "hidden";
}
switch(this.m_aAct){
case AE_NONE:
if(g_vml)
ShowVGXObj(this.m_obj);
break;
case AE_DIM:
if(g_vml)
ShowVGXObj(this.m_obj);
g_animManager.m_objToDim =this.m_obj;
g_animManager.m_colorToDim =this.m_oldc;
break;
case AE_HIDE:
g_animManager.m_objToHide =this.m_obj;
break;
case AE_HIDEIMDTLY:
rStyle.visibility ="hidden";
break;
}
if(this.m_dId != "")
this.m_animObj.style.visibility ="hidden";
if(!g_animManager.m_isPlaying){
g_curAnim = null;
this.m_obj = null;
g_animManager.Peek();
}
}
function A_Animate(){
switch(GetAnimClass(this.m_build)) {
case 1:
case 2: this.DoMove(); break;
case 3: this.DoSpiral(); break;
case 4: this.DoSwivel(); break;
}
if(--this.m_steps == 0)
this.End();
}
function A_SetupMove(){
dir =this.m_build;
this.m_steps =GetSteps(dir);
rObj =this.m_dId != "" ? document.all.item(this.m_dId) : this.m_obj;
this.m_animObj =rObj;
offsetL=0;
offsetT=0;
parentObj=rObj.parentElement;
while(parentObj.tagName != "BODY" && parentObj.id != "SlideObj"){
offsetL +=parentObj.offsetLeft;
offsetT +=parentObj.offsetTop;
parentObj =parentObj.parentElement;
}
rStyle = rObj.style;
this.m_finalL =sLeft =rStyle.pixelLeft;
this.m_finalT =sTop =rStyle.pixelTop;
this.m_finalW =sWidth =rStyle.pixelWidth;
this.m_finalH =sHeight =rStyle.pixelHeight;
clientW=SlideObj.style.pixelWidth-offsetL;
clientH=SlideObj.style.pixelHeight-offsetT;
if(dir < 100) {
switch(dir) {
case 0: case 12: sLeft=-(sWidth+offsetL); break;
case 1: case 13: sTop=-(sHeight+offsetT); break;
case 2: case 14: sLeft=clientW; break;
case 3: case 15: sTop=clientH; break;
case 4:
sLeft=-(sWidth+offsetL);
sTop=-(sHeight+offsetT);
break;
case 5:
sLeft=clientW;
sTop=-(sHeight+offsetT);
break;
case 6:
sLeft=-(sWidth+offsetL);
sTop=clientH;
break;
case 7:
sLeft=clientW;
sTop=clientH;
break;
case 8: sLeft-=sWidth; break;
case 9: sTop+=sHeight; break;
case 10: sLeft+=sWidth; break;
case 11: sTop-=sHeight; break;
case 16:
sLeft+=sWidth/2;
sTop+=sHeight/2;
sWidth=0;
sHeight=0;
break;
case 17:
sLeft+=sWidth/6;
sTop+=sHeight/6;
sWidth=sWidth*2/3;
sHeight=sHeight*2/3;
break;
case 18:
sLeft-=(3*sWidth)/2;
sTop-=(3*sHeight)/2;
sWidth=sWidth*4;
sHeight=sHeight*4;
break;
case 19:
sLeft-=sWidth/6;
sTop-=sHeight/6;
sWidth=sWidth*4/3;
sHeight=sHeight*4/3;
break;
case 20:
sLeft=clientW/2;
sTop=clientH/2;
sWidth=0;
sHeight=0;
break;
case 21:
sLeft= 0;
sTop=clientH;
sWidth=clientW;
sHeight=clientH;
break;
case 22:
sLeft+=sWidth/2;
sWidth=0;
break;
case 23: sWidth=0; break;
case 24: sHeight=0; break;
case 25:
sLeft+=sWidth;
sWidth=0;
break;
case 26:
sTop+=sHeight;
sHeight=0;
break;
case 27:
sLeft+=sWidth/2;
sWidth=0;
break;
case 28:
sLeft=0;
sTop=clientH;
sWidth=0;
sHeight=0;
break;
}
}
if(0 == sWidth)
sWidth++;
rStyle.pixelLeft=sLeft;
rStyle.pixelTop=sTop;
rStyle.pixelWidth=sWidth;
rStyle.pixelHeight=sHeight;
}
function A_DoInplace(){
if(this.m_animObj.filters.revealtrans){
this.m_animObj.filters.revealtrans.Apply();
this.m_animObj.style.visibility ="visible";
this.m_animObj.filters.revealtrans.Play();
}
}
function A_DoMove(){
rStyle = this.m_animObj.style;
rStyle.pixelLeft +=(this.m_finalL - rStyle.pixelLeft)/this.m_steps;
rStyle.pixelTop +=(this.m_finalT - rStyle.pixelTop)/this.m_steps;
rStyle.pixelWidth +=(this.m_finalW - rStyle.pixelWidth)/this.m_steps;
rStyle.pixelHeight +=(this.m_finalH - rStyle.pixelHeight)/this.m_steps;
}
function A_DoSpiral(){
ratio =this.m_steps / GetSteps(this.m_build);
angle =2*ratio*3.14;
cosa =Math.cos(angle);
sina =Math.sin(angle);
vx =(this.m_finalL + this.m_finalW / 2)*ratio;
vy =(this.m_finalT + this.m_finalH / 2 - SlideObj.style.pixelHeight) * ratio;
rStyle =this.m_animObj.style;
rStyle.pixelLeft =this.m_finalL - vx * cosa - vy * sina;
rStyle.pixelTop =this.m_finalT + vx * sina - vy * cosa;
rStyle.pixelWidth =this.m_finalW * (1 - ratio);
rStyle.pixelHeight =this.m_finalH * (1 - ratio);
}
function A_DoSwivel(){
rStyle =this.m_animObj.style;
angle =this.m_steps / GetSteps(this.m_build) * 5 * 3.14 / 2;
difX =Math.abs(this.m_finalW * Math.cos(angle));
rStyle.pixelLeft =this.m_finalL + (this.m_finalW - difX) / 2;
if(0 == difX) difX++;
rStyle.pixelWidth =difX;
}
function DocumentOnClick()
{
if( IsNts() || parent.HideMenu() ) return
_DocAction()
}
function _DocAction()
{
if( g_animManager && g_animManager.m_isPlaying && g_curAnim )
StopMedia( g_curAnim.m_video );
if( ( g_showAnimation && !g_curAnim &&
g_animManager && g_animManager.Next() ) )
return;
if( ( g_allowAdvOnClick && (window.name=="PPTSld") && !parent.IsFramesMode() &&
!g_curAnim ) || (!g_curAnim && event && event.keyCode==32) )
parent.GoToNextSld();
}
var g_supportsPPTHTML = SupportsPPTHTML(), g_scaleInFrame = true, gId="", g_bgSound="",
g_scaleHyperlinks = false, g_allowAdvOnClick = true, g_showInBrowser = false;
var g_showAnimation = g_supportsPPTHTML && SupportsPPTAnimation() && ( (window.name=="PPTSld" && !parent.IsFramesMode()) || g_showInBrowser );var g_hasTrans = false, g_autoTrans = false, g_transSecs = 0;
var g_isKiosk = 0;var g_animManager = null;
var ENDSHOW_MESG="
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -