Animation de texte

Contenu du snippet

ce code n'est pas de moi, mais il est sympa alors je l'ai posté. il faut savoir partager les bonnes choses ds la vie... ;)

Source / Exemple :


Code à placer dans la partie HEAD :

<SCRIPT LANGUAGE="JavaScript">n = (document.layers) ? 1:0; ie = (document.all) ? 1:0
function kdebut() { grey = new dynLayer("greyDiv"); grey.circle(80,2,0,null,1,4,90) }
function dynLayer(id) { if (n) { this.css = document.layers[id]
this.ref = document.layers[id].document; this.x = this.css.left; this.y = this.css.top }
else if (ie) {this.css = document.all[id].style;this.ref = document;this.x = this.css.pixelLeft
this.y = this.css.pixelTop } ;this.obj = id + "Object"; eval(this.obj + "=this")
this.moveBy = dynLayerMoveBy; this.moveTo = dynLayerMoveTo; this.circle = dynLayerCircle
this.circleSlide = dynLayerCircleSlide }
function dynLayerMoveBy(x,y) { this.x += x; this.css.left = this.x; this.y += y; this.css.top = this.y }
function dynLayerMoveTo(x,y) { this.x = x; this.css.left = this.x; this.y = y; this.css.top = this.y }
function dynLayerCircle(radius,angleinc,angle,endangle,vertical,horizontal,speed,fn) {
if (!this.circleActive) { var centerX = this.x - horizontal*radius*Math.cos(angle*Math.PI/180)
var centerY = this.y + vertical*radius*Math.sin(angle*Math.PI/180); if (endangle!=null) {
angleinc = Math.abs(angleinc); if (endangle<angle) angleinc*=-1 }; this.circleActive = 1
this.circleSlide(radius,angleinc,angle,endangle,vertical,horizontal,centerX,centerY,speed,fn)}}
function dynLayerCircleSlide(radius,angleinc,angle,endangle,vertical,horizontal,centerX,centerY,speed,fn) {
if (!fn) fn = null; if (this.circleActive && (endangle==null || endangle!=null && Math.abs(angleinc)<Math.abs(endangle-angle) )) {
angle += angleinc; var x = centerX + horizontal*radius*Math.cos(angle*Math.PI/180);
var y = centerY - vertical*radius*Math.sin(angle*Math.PI/180); this.moveTo(x,y)
setTimeout(this.obj+".circleSlide("+radius+","+angleinc+","+angle+","+endangle+","+vertical+","+horizontal+","+centerX+","+centerY+","+speed+",\""+fn+"\")",speed)}
else { this.circleActive = 0 ;if (endangle!=null) { 
var x = Math.round(centerX + horizontal*radius*Math.cos(endangle*Math.PI/180));var y = Math.round(centerY - vertical*radius*Math.sin(endangle*Math.PI/180))
this.moveTo(x,y)} ; eval(fn)}} 
--></SCRIPT><DIV ID="greyDiv" STYLE="position:absolute; left:640; top:2980; WIDTH:250; HEIGHT:50; VISIBILITY:visible;">
<FONT COLOR="#00FF00" SIZE=+2 FACE="Verdana">KS JAVASCRIPT</FONT></DIV>

Code à placer dans la partie BODY :

<FORM><INPUT TYPE="button" VALUE="Cliquez ici puis observez..." onClick="kdebut()">

Conclusion :


by Kortal (coder@kortal.cjb.net)
[ http://kortal.cjb.net ]

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.