ANIMACIA PO KRIVKE

ID
Nazov / Name:
Popis / Description:
Dlzka / Length:
Testovane pod / Tested under:

 

189
p189.html / p189.zip
Animacia obrazku po casti krivky
49903b
NN 4.04, IE 4.0

UKAZKA / CLICK HERE

Zdrojovy tvar / Source code:

<HTML> <HEAD> <TITLE>JavaScript DESTINATION - P189</TITLE> <script language="JavaScript"> <!-- function MM_timelineGoto(tmLnName, fNew, numGotos) { var i,j,tmLn,props,keyFrm, sprite, numKeyFr,firstKeyFr,lastKeyFr, propNum; if (document.MM_Time == null) MM_initTimelines(); tmLn = document.MM_Time[tmLnName]; if (numGotos == parseInt(numGotos)) if (tmLn.gotoCount == null) tmLn.gotoCount = 1; else if (tmLn.gotoCount++ >= numGotos) {tmLn.gotoCount=0; return} jmpFwd = (fNew > tmLn.curFrame); for (i = 0; i < tmLn.length; i++) { sprite = (jmpFwd)? tmLn[i] : tmLn[(tmLn.length-1)-i]; if (sprite.charAt(0) == "s") { numKeyFr = sprite.keyFrames.length; firstKeyFr = sprite.keyFrames[0]; lastKeyFr = sprite.keyFrames[numKeyFr - 1]; if ((jmpFwd && fNew<firstKeyFr) || (!jmpFwd && lastKeyFr<fNew)) continue; for (keyFrm=1; keyFrm<numKeyFr && fNew>=sprite.keyFrames[keyFrm]; keyFrm++); for (j=0; j<sprite.values.length; j++) { props = sprite.values[j]; if (numKeyFr == props.length) propNum = keyFrm-1 else propNum = Math.min(Math.max(0,fNew-firstKeyFr),lastKeyFr-1); if (props.prop2 == null) sprite.obj[props.prop] = props[propNum]; else sprite.obj[props.prop2][props.prop] = props[propNum]; } } } tmLn.curFrame = fNew; if (tmLn.ID == 0) eval('MM_timelinePlay(tmLnName)'); } function MM_timelinePlay(tmLnName, myID) { var i,j,tmLn,props,keyFrm, sprite, numKeyFr,firstKeyFr, propNum; if (document.MM_Time == null) MM_initTimelines(); tmLn = document.MM_Time[tmLnName]; if (myID != parseInt(myID)) myID = ++tmLn.ID; if (myID == tmLn.ID) { setTimeout('MM_timelinePlay("'+tmLnName+'",'+myID+')',tmLn.delay); fNew = ++tmLn.curFrame; for (i=0; i<tmLn.length; i++) { sprite = tmLn[i]; if (sprite.charAt(0) == 's') { numKeyFr = sprite.keyFrames.length; firstKeyFr = sprite.keyFrames[0]; if (fNew >= firstKeyFr && fNew <= sprite.keyFrames[numKeyFr-1]) { for (keyFrm=1; keyFrm<numKeyFr && fNew>=sprite.keyFrames[keyFrm]; keyFrm++); for (j=0; j<sprite.values.length; j++) { props = sprite.values[j]; propNum = (numKeyFr == props.length)?(keyFrm-1):(fNew-firstKeyFr); if (props.prop2 == null) sprite.obj[props.prop] = props[propNum]; else sprite.obj[props.prop2][props.prop] = props[propNum]; } } } else if (sprite.charAt(0)=='b' && fNew == sprite.frame) eval(sprite.value); if (fNew > tmLn.lastFrame) tmLn.ID = 0; } } } function MM_initTimelines() { var ns = navigator.appName == "Netscape"; document.MM_Time = new Array(1); document.MM_Time[0] = new Array(3); document.MM_Time["Timeline1"] = document.MM_Time[0]; document.MM_Time[0].MM_Name = "Timeline1"; document.MM_Time[0].fps = 15; document.MM_Time[0][0] = new String("sprite"); document.MM_Time[0][0].slot = 1; document.MM_Time[0][0].obj = (ns) ? document.Layer1 : document.all["Layer1"]; document.MM_Time[0][0].keyFrames = new Array(1, 8, 15, 23, 30, 38, 45, 53, 60, 68, 75, 83, 90); document.MM_Time[0][0].values = new Array(4); document.MM_Time[0][0].values[0] = new Array(33,51,68,86,104,122,140,159,178,196,214,232,250,267,285,270,254,239,223,207,191,175,159,140,122,104,86,68,51,33,48,64,79,95,111,127,143,159,178,196,214,232,250,267,285,270,254,239,223,207,191,175,159,140,122,104,86,68,51,33,48,64,79,95,111,127,143,159,178,196,214,232,250,267,285,270,254,239,223,207,191,175,159,140,122,104,86,68,51,33); document.MM_Time[0][0].values[0].prop = "left"; document.MM_Time[0][0].values[1] = new Array(124,118,112,107,101,97,93,92,94,97,101,106,112,118,124,119,114,109,104,100,97,94,93,94,98,102,107,112,118,124,119,114,109,104,100,97,94,93,94,98,102,107,112,118,124,119,114,109,104,100,97,94,93,94,98,102,107,112,118,124,119,114,109,104,100,97,94,93,94,98,102,107,112,118,124,119,114,109,104,100,97,94,93,94,98,102,107,113,119,124); document.MM_Time[0][0].values[1].prop = "top"; if (!ns) { document.MM_Time[0][0].values[0].prop2 = "style"; document.MM_Time[0][0].values[1].prop2 = "style"; } document.MM_Time[0][0].values[2] = new Array(37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37); document.MM_Time[0][0].values[2].prop = "width"; if (!ns) document.MM_Time[0][0].values[2].prop2 = "style"; document.MM_Time[0][0].values[3] = new Array(79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79); document.MM_Time[0][0].values[3].prop = "height"; if (!ns) document.MM_Time[0][0].values[3].prop2 = "style"; document.MM_Time[0][1] = new String("sprite"); document.MM_Time[0][1].slot = 2; document.MM_Time[0][1].obj = (ns) ? document.Image1 : document.Image1; document.MM_Time[0][1].keyFrames = new Array(1, 15, 30, 45, 60, 75, 90); document.MM_Time[0][1].values = new Array(1); document.MM_Time[0][1].values[0] = new Array("images/bar_blank.gif","images/bar_bright_blue_cola.gif","images/bar_its_the_best.gif","images/bar_drink_some_now.gif","images/bar_then_take_a_rest.gif","images/bar_bright_blue_cola.gif","images/bar_blank.gif"); document.MM_Time[0][1].values[0].prop = "src"; document.MM_Time[0][2] = new String("behavior"); document.MM_Time[0][2].frame = 91; document.MM_Time[0][2].value = "MM_timelineGoto('Timeline1', 1)"; document.MM_Time[0].lastFrame = 91; for (i=0; i<document.MM_Time.length; i++) { document.MM_Time[i].ID = null; document.MM_Time[i].curFrame = 0; document.MM_Time[i].delay = 1000/document.MM_Time[i].fps; } } // --> </script> </HEAD> <BODY BGCOLOR="#FFFFFF" onload="MM_timelinePlay('Timeline1')"> <BR> <BR> <BR> <BR> <div id="Layer1" style="position:absolute; width:37; height:79px; z-index:1;; left:33px; top:124px"> <img src="images/smallbottle.gif" width="37" height="37"> </div> <p><img src="images/bar_blank.gif" width="320" height="25" name="Image1"> </p> </BODY> </HTML>
[ Navrat / BACK ]