Zufall
Im Focus das Element mit den zufälligen Bewegungen mit Eingabemasken zum Steuern.
Zufallsbewegung mit DhtmlObject
Eine Reihe von Aufrufen von DhtmlObject inklusive eines
Formulars, mit dem Sie alle möglichen Parameter definieren können.
Ergebnis
Start Nashorn
Start Hund
Start Beide
Quellcode
<script language="javascript" type="text/javascript" src="/javascript/javascriptExamples/DhtmlObject.js"></script>
<!-- Objekte -->
<div id="nashorn" style="position:absolute;visibility:hidden;"><a href="#example"
onmouseover="myNashorn.visibility('visible');"
onmouseout="myNashorn.visibility('hidden');" ><img
src="/pic/example/nashorn.jpg"
width=320 height=170" name="Nashorn" border="1"></a></div>
<div id="hund" style="position:absolute;visibility:hidden;"><a href="#example"
onmouseover="myHund.visibility('visible');"
onmouseout="myHund.visibility('hidden');" ><img
src="/pic/example/hund.jpg"
width=320 height=170" name="Hund" border="1"></a></div>
<!-- Aktionen -->
<a href="#example" onclick="
myNashorn.visibility('visible');
myNashorn.zIndex(3);
myNashorn.animationStart({'animationType':'randomPath', 'totalLoops':1, 'pathLength':40, 'pathTime':0.1, 'steps':100, 'positionX':400, 'positionY':400});
myNashorn.zIndex(2);
" >Start Nashorn</a><br>
<a href="#example" onclick="
myHund.visibility('visible');
myHund.zIndex(3);
myHund.animationStart({'animationType':'randomPath', 'totalLoops':1, 'pathLength':20, 'pathTime':0.1, 'steps':100, 'positionX':400, 'positionY':400});
myHund.zIndex(2);
" >Start Hund</a><br>
<a href="#example" onclick="
myNashorn.visibility('visible');
myNashorn.animationStart({'animationType':'randomPath', 'totalLoops':1, 'pathLength':30, 'pathTime':0.1, 'steps':100, 'positionX':400, 'positionY':400});
myHund.visibility('visible');
myHund.animationStart({'animationType':'randomPath', 'totalLoops':1, 'pathLength':100, 'pathTime':0.1, 'steps':100, 'positionX':400, 'positionY':400});
" >Start Beide</a><br>
<form>
totalLoops: <input type="text" size="5" value="1" onchange="animationProperties['totalLoops'] = parseInt(this.value);" ><br>
steps: <input type="text" size="5" value="100" onchange="animationProperties['steps'] = parseInt(this.value);" ><br>
pathTime (sek):<input type="text" size="5" value="0.1" onchange="animationProperties['pathTime'] = Number(this.value);" ><br>
stepTime (sek):<input type="text" size="5" value="0" onchange="animationProperties['stepTime'] = Number(this.value);" ><br>
pathLength: <input type="text" size="5" value="100" onchange="animationProperties['pathLength'] = parseInt(this.value);" ><br>
pathLengthX: <input type="text" size="5" value="0" onchange="animationProperties['pathLengthX'] = parseInt(this.value);" ><br>
pathLengthY: <input type="text" size="5" value="0" onchange="animationProperties['pathLengthY'] = parseInt(this.value);" ><br>
flowX: <input type="text" size="5" value="0" onchange="animationProperties['flowX'] = parseInt(this.value);" ><br>
flowY: <input type="text" size="5" value="0" onchange="animationProperties['flowY'] = parseInt(this.value);" ><br>
positionX: <input type="text" size="5" value="400" onchange="animationProperties['positionX'] = parseInt(this.value);" ><br>
positionY: <input type="text" size="5" value="400" onchange="animationProperties['positionY'] = parseInt(this.value);" ><br>
<input type="button" value="starte Zufallsbewegung" onclick="
myHund.visibility('visible');
myHund.zIndex(3);
myHund.animationStart(animationProperties);
myHund.zIndex(2);
" >
</form>
<script language="javascript"><!--
// create DhtmlObjects
var myNashorn = new DhtmlObject('nashorn', 'myNashorn');
var myHund = new DhtmlObject('hund', 'myHund');
// Values of Form
animationProperties = new Array();
animationProperties['animationType'] = 'randomPath';
animationProperties['pathLength'] = 100;
animationProperties['pathLengthX'] = 0;
animationProperties['pathLengthY'] = 0;
animationProperties['flowX'] = 0;
animationProperties['flowY'] = 0;
animationProperties['positionX'] = 400;
animationProperties['positionY'] = 400;
animationProperties['pathTime'] = 0.1;
animationProperties['stepTime'] = 0;
animationProperties['steps'] = 100;
//-->
</script>
Die Methode randomPath von DhtmlObject
Beispiel
NN
MSIE
Opera
2
3
4
4.5
6
3
4
5
5.5
3.6
4
5
randomPath
Die Funktion für den Zufallspfad erlaubt die Steuerung mit einer ganzen Reihe von Parametern
wird unterstützt
wird größtenteils unterstützt
wird teilweise unterstützt
wird nicht unterstützt
keine direkte Funktion
gefährlich
Links
Ihr Browser kann derzeit kein
JavaScript, bzw. erkennt kein noscript. weshalb eine Reihe von Beispielen nicht funktionieren werden!
Verwenden Sie bitte einen moderneren JavaScript-fähigen Browser oder
aktivieren Sie JavaScript.
(München, 2001-02-19 00:00:00 /
)