| Fael look & draw Profil : Penguin Pro | | |
jcbrinfo JCBR Info Profil : Penguin | Avec JavaScript, tu change graduellement la couleur de police lors du survol et lors de la sortie du curseur. Tu n'as qu'à utiliser:
---------------
JCBR Info
| |
jcbrinfo JCBR Info Profil : Penguin | Un petit exemple de mon cru (pas encore au point):
Code :
- //La couleur du lien à la fin pour anim_link_toColor()
- var anim_link_r='0';
- var anim_link_g='128';
- var anim_link_b='255';
- //Variables internes
- var anim_link_temp=new Array();
- var anim_link_cr=0;
- var anim_link_cg=0;
- var anim_link_cb=0;
- //Fonction blanc->couleur
- function anim_link_toColor(v_obj,v_time)
- {var anim_link_cr=255;
- var anim_link_cg=255;
- var anim_link_cb=255;
- var v_i=anim_link_temp.lenght;
- anim_link_temp[v_i]=setInterval('anim_link_toColorI(\''+v_obj.id+'\','+v_i+');',v_time);}
- //Fonction couleur->blanc
- function anim_link_toWhite(v_obj,v_time)
- {var anim_link_cr=anim_link_r;
- var anim_link_cg=anim_link_g;
- var anim_link_cb=anim_link_b;
- var v_i=anim_link_temp.lenght;
- anim_link_temp[v_i]=setInterval('anim_link_toWhiteI(\''+v_obj.id+'\','+v_i+');',v_time);}
- //Fontions internes
- function anim_link_toColorI(v_ID,v_i)
- {if(anim_link_cr>anim_link_r)
- {anim_link_cr--;}
- if(anim_link_cg>anim_link_g)
- {anim_link_cg--;}
- if(anim_link_cb>anim_link_b)
- {anim_link_cb--;}
- document.getElementById(v_ID).style.color='rgb(anim_link_cr,anim_link_cg,anim_link_cb)';
- if((anim_link_cb<=anim_link_r)&&(anim_link_cb<=anim_link_g)&&(anim_link_cb<=anim_link_b))
- {clearInterval(anim_link_temp[v_i]);}}
- function anim_link_toWhiteI(v_ID,v_i)
- {if(anim_link_cr<255)
- {anim_link_cr++;}
- if(anim_link_cg<255)
- {anim_link_cg++;}
- if(anim_link_cb<255)
- {anim_link_cb++;}
- document.getElementById(v_ID).style.color='rgb(anim_link_cr,anim_link_cg,anim_link_cb)';
- if((anim_link_cb>=255)&&(anim_link_cb>=255)&&(anim_link_cb>=255))
- {clearInterval(anim_link_temp[v_i]);}}
- //Notes:
- // -v_obj: ton objet HTML (dans les événements, utilise le mot-clé this)
- // -v_time: temps, en millisecondes, entre chaque changment de couleur de 1 unité
|
Message édité par jcbrinfo le 12-06-2009 à 04:03:16 ---------------
JCBR Info
| |
Fael look & draw Profil : Penguin Pro | | |
jcbrinfo JCBR Info Profil : Penguin | Mon script est un essai pour faire des transitions couleur de ton choix blanc et inverse.
EDIT: J'ai fini par faire un script fonctionnel (pas encore testé). Il faut par contre que je règle encore quelques petits détails.
Le script Javascript:
Code :
- //Variable interne
- var anim_link_temp=new Array();
- //Fonction à appeler
- function anim_link(v_obj,v_time,v_fps,v_ir,v_ig,v_ib,v_fr,v_fg,v_fb)
- {var v_i=anim_link_temp.lenght;
- anim_link_temp[v_i]=new Aray(11);
- anim_link_temp[v_i][0]=v_fr;
- anim_link_temp[v_i][1]=v_fg;
- anim_link_temp[v_i][2]=v_fb;
- anim_link_temp[v_i][3]=(v_fr-v_ir)/v_time*v_fps;
- anim_link_temp[v_i][4]=(v_fg-v_ig)/v_time*v_fps;
- anim_link_temp[v_i][5]=(v_fb-v_ib)/v_time*v_fps;
- anim_link_temp[v_i][6]=v_ir;
- anim_link_temp[v_i][7]=v_ig;
- anim_link_temp[v_i][8]=v_ib;
- anim_link_temp[v_i][9]=0;
- anim_link_temp[v_i][10]=setInterval('anim_link_toColorI(\''+v_obj.id+'\','+v_i+','+v_time*v_fps+');',Math.floor(v_time*1000/v_fps));}
- //Fontion interne
- function anim_link_I(v_ID,v_i,v_fnbr)
- {anim_link_temp[v_i][6]=Math.floor(anim_link_temp[v_i][6]+anim_link_temp[v_i][3]);
- anim_link_temp[v_i][7]=Math.floor(anim_link_temp[v_i][7]+anim_link_temp[v_i][4]);
- anim_link_temp[v_i][8]=Math.floor(anim_link_temp[v_i][8]+anim_link_temp[v_i][5]);
- document.getElementById(v_ID).style.color='rgb(anim_link_temp[v_i][6],aanim_link_temp[v_i][7],anim_link_temp[v_i][8])';
- if(anim_link_temp[v_i][9]==v_fnbr)
- {clearInterval(anim_link_temp[v_i][10]);
- document.getElementById(v_ID).style.color='rgb(anim_link_temp[v_i][0],anim_link_temp[v_i][1],anim_link_temp[v_i][2])';}
- anim_link_temp[v_i][9]++;}
|
Faire les liens comme suit:
Citation :
<a href="chemin" onmouseover="anim_link(this,temps de l'animation (secondes),images par secondes,Rouge initial,Vert initial,Bleu initial,Rouge final,Vert final,Bleu final);" onmouseout="anim_link(this,temps de l'animation (secondes),images par secondes,Rouge initial,Vert initial,Bleu initial,Rouge final,Vert final,Bleu final);">texte</a>
|
onmouseover: Lors du survol de la souris.
onmouseover: Lors de la sortie de la souris.
Teste-le quand même pour voir si ça te convient et donne-moi-en des nouvelles.
Message édité par jcbrinfo le 13-06-2009 à 00:36:18 ---------------
JCBR Info
| |
Fael look & draw Profil : Penguin Pro | Le script que Chozo a fait lui-même :
Code :
- /*
- *Site.js - @author:Chozo-MJ
- */
- /*initialsiation des liens (effets sur la couleur du lien)*/
- function initLink(){
- $$('a').each(function(e) {
- e.color=e.getStyle('color'); //couleur normal
- e.effect=new Effect.Morph(e,{});
- e.observe('mouseover', function(event) {
- //e.stop();
- if (!e.aColor) e.aColor=e.getStyle('color');
- e.setStyle({'color':e.color});
- //e.morph('color:'+e.aColor);
- e.effect= new Effect.Morph(e,{
- style:{'color':e.aColor},
- beforeStart: function(r) {
- e.effect.cancel();
- },
- duration:0.5,
- });
- });
- e.observe('mouseout', function(event) {
- e.effect= new Effect.Morph(e,{
- style:{'color':e.color},
- beforeStart: function(r) {
- e.effect.cancel();
- },
- afterFinish: function(effect) {
- },
- duration:0.5,
- });
- },false);
- });
- }
|
Je vais essayer de contacter Chozo qui nous explique ça.
---------------
 
[Paintings & Airbrushing]-[Webdesigns]
La vitesse de la lumière va plus vite que celle du son,
c'est pour cela que l'on voit les gens brillants avant de les savoir cons.
| |
jcbrinfo JCBR Info Profil : Penguin | Jette un coup d'oeil à mon précédant message, j'ai fait une solution prêt-à-l'emploi. (Il me reste un petit détail à régler, mais cela concerne une limite qui ne devrait pas influencer les tests. ) Message édité par jcbrinfo le 13-06-2009 à 01:06:37 ---------------
JCBR Info
| |
Fael look & draw Profil : Penguin Pro | | |
jcbrinfo JCBR Info Profil : Penguin | Même si tu as trouvé ce que tu cherche, je tiens à mettre ici la version débugué de mon script. Exemple:
Code :
- <html>
- <head>
- <script type="text/javascript" language="javascript">
- //Variable interne
- var anim_link_temp=new Array();
- //Fonction à appeler
- function anim_link(v_obj,v_time,v_fps,v_ir,v_ig,v_ib,v_fr,v_fg,v_fb)
- {var v_i=0;
- var v_ok=0;
- for(v_i=0;v_i<anim_link_temp.lenght;v_i++)
- {if(!(anim_link_temp[v_i][11]))
- {v_ok=true;
- break;}}
- if(!(v_ok))
- {v_i=anim_link_temp.length;}
- anim_link_temp[v_i]=new Array(12);
- anim_link_temp[v_i][0]=v_fr;
- anim_link_temp[v_i][1]=v_fg;
- anim_link_temp[v_i][2]=v_fb;
- anim_link_temp[v_i][3]=(v_fr-v_ir)/v_time/v_fps;
- anim_link_temp[v_i][4]=(v_fg-v_ig)/v_time/v_fps;
- anim_link_temp[v_i][5]=(v_fb-v_ib)/v_time/v_fps;
- anim_link_temp[v_i][6]=v_ir;
- anim_link_temp[v_i][7]=v_ig;
- anim_link_temp[v_i][8]=v_ib;
- anim_link_temp[v_i][9]=0;
- anim_link_temp[v_i][10]=setInterval('anim_link_I(\''+v_obj.id+'\','+v_i+','+v_time*v_fps+');',Math.floor(v_time*1000/v_fps));
- anim_link_temp[v_i][11]=true;
- //document.getElementById('test').innerHTML+='<br>';
- }
- //Fontion interne
- function anim_link_I(v_ID,v_i,v_fnbr)
- {anim_link_temp[v_i][6]=Math.floor(anim_link_temp[v_i][6]+anim_link_temp[v_i][3]);
- anim_link_temp[v_i][7]=Math.floor(anim_link_temp[v_i][7]+anim_link_temp[v_i][4]);
- anim_link_temp[v_i][8]=Math.floor(anim_link_temp[v_i][8]+anim_link_temp[v_i][5]);
- document.getElementById(v_ID).style.color='rgb('+anim_link_temp[v_i][6]+','+anim_link_temp[v_i][7]+','+anim_link_temp[v_i][8]+')';
- //document.getElementById('test').innerHTML+='rgb('+anim_link_temp[v_i][6]+','+anim_link_temp[v_i][7]+','+anim_link_temp[v_i][8]+');';
- if(anim_link_temp[v_i][9]==v_fnbr)
- {clearInterval(anim_link_temp[v_i][10]);
- anim_link_temp[v_i][11]=false;
- document.getElementById(v_ID).style.color='rgb('+anim_link_temp[v_i][0]+','+anim_link_temp[v_i][1]+','+anim_link_temp[v_i][2]+')';}
- anim_link_temp[v_i][9]++;}
- </script>
- </head>
- <body>
- <a id="monlien1" href="http://www.google.ca/" onmouseover="anim_link(this,1,10,0,210,255,255,0,222);" onmouseout="anim_link(this,1,10,255,0,222,0,210,255);">texte</a>
- </body>
- </html>
|
Les parties en gras sont propre à chaque lien. Note: C'était normal que ça ne fonctionnait pas, j'avais fait plein d'ereurs. Maintenant, elles sont corrigés. Message édité par jcbrinfo le 13-06-2009 à 23:50:52 ---------------
JCBR Info
| |
| |