Nová ukázka
Reset
Načíst z URL
Uložit a získat odkaz
Vztahuje se k…
Nevyplňujte
Napiště „nejsem robot“
▶
Přepnout zobrazení
Výsledek
<body style="display:flex;height:100vh;margin:0px;padding:0px"> <div style="height:1em;border:1px solid black;position:absolute;" id="0">Utíkající text!</div>
HTML
Autoformát
Standardní režim
Mobilní zobrazení
CSS
Autoformát
CSS reset
Až na konci
var anim = (function() { Array.prototype.add=function(a){var i=0;while(i in this){i++}this[i]=a;return i;}; anim={}; var animKeyFrames=[]; anim.fps=0; anim.initDuration=10; anim.play=true; anim.addFraming=function(fc){return animKeyFrames.add(fc)}; anim.delFraming=function(fcid){delete animKeyFrames[fcid];}; function animationFraming() { for(i=0;i<=animKeyFrames.length;i++) { if(animKeyFrames[i])animKeyFrames[i](); } if(anim.play)requestAnimationFrame(animationFraming); } anim.Vector=function(elem, add) { if(!elem.style){throw "Anim Error code 15: Undefined element.";} if(!add.pitch){throw "Anim Error code 15: Undefined pitch.";} if(!add.speed){throw "Anim Error code 15: udefined speed.";} var state=1; var duration=anim.initDuration; this.pause=function(){state=2}; this.stop=function(){state=0}; this.play=function(){state=1}; this.backPlay=function(){ix=-ix;iy=-iy;}; if(typeof add.duration == "number")duration=add.duration; var ix=Math.sin(add.pitch/(180/Math.PI))*add.speed; var iy=-(Math.cos(add.pitch/(180/Math.PI))*add.speed); if(!elem.style.top)elem.style.top="0px"; if(!elem.style.left)elem.style.left="0px"; function animating(){ if(state==2)return; if(!state)anim.delFraming(frameNumber); elem.style["left"]=parseFloat(elem.style["left"].replace('px',""))+ix+"px"; elem.style["top"]=parseFloat(elem.style["top"].replace('px',""))+iy+"px"; } var frameNumber=anim.addFraming(animating); }; animationFraming(); return anim; } )(); var vector=new anim.Vector(document.getElementById('0'),{pitch:115,speed:2.1}); setInterval(vector.backPlay,3000) //předpokádaný zápis dalších hodnot: {duration:20, length: 50} //all times is in frames.
J
ava
S
cript
Autoformát
jQuery
Umístění JS
window.onload
</head>
</body>