CCG 19
Explications

 
 
* En bleu: les explications
* En rouge, violet ou vert: ce que l'on peut changer
* En noir: préférable de ne pas toucher
 
 
C'est dans cette partie que nous allons définir l'emplacement de la "Cellule" dans laquelle sera écrit le texte ainsi que le style des caractères utilisés:

<STYLE>BODY {
 MARGIN-TOP: 0px; FONT-SIZE: 10px; MARGIN-LEFT: 400px; COLOR: #ffffff; MARGIN-RIGHT: 30px; FONT-STYLE: normal; FONT-FAMILY: Comic sans ms
}
</STYLE>
 
Ici, la musique:
<BGSOUND id=music balance=0 src="D:\CCG Lifnet\CCG19\survivor.mid"
volume=0 loop=infinite>

<META content="MSHTML 5.50.4912.300" name=GENERATOR></HEAD>
 
 
Ici on va définir le fond d'écran.  On peut y appliquer un dégradé (filtre Gradient), une couleur unie ou encore une image...ou une combinaison dégradé et image: (Note: Les "kk" ajoutés aux couleurs permettent d'éviter l'application du filtre "gradient" tout en conservant ces lignes dans le script...pas très élégant, mais ça fonctionne :-)) )
<BODY
style="Z-INDEX: -10; FILTER: progid:DXImageTransform.Microsoft.Gradient(startColorstr=#ffffffkk,endColorstr=#29006bkk, GradientType=1); LEFT: 0px; WIDTH: 200%; POSITION: absolute; TOP: 0px; HEIGHT: 100%"
bgProperties=fixed bgColor=#000000
background="D:\CCG Lifnet\CCG19\fond.jpg">
 

<DIV align=center>
 
Ici on va définir les dimensions de la "Cellule" dans laquelle sera inscrite le texte.  Note: Il est aussi possible d'en changer les dimensions avec la souris lors de l'édition du texte:
<TABLE
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; MARGIN-LEFT: 20px; WIDTH: 360px; HEIGHT: 278px; TEXT-ALIGN: left"
cellSpacing=0 cellPadding=0 width=360 border=0>
  <TBODY>
  <TR>
    <TD width="100%">
      <DIV align=left>
      <TABLE
 
Ici la couleur du fond des cellules du texte ainsi que la couleur des bordures:
      style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FILTER: alpha(opacity=75); TEXT-ALIGN: center"
      borderColorDark=#27371c width="100%" borderColorLight=#27371c border=5
      table 40%?>
        <TBODY>
        <TR bgColor=#b32926>
          <TD style="TEXT-ALIGN: center" align=left height=51>
            <P align=left>Hello tout le monde,</P>
            <P align=left>Voici donc le CCG19.&nbsp;J'aime bien l'effet produit
            par ce script.&nbsp; Il n'y a pas beaucoup de paramètres à
            changer...ce qui laissera un peu de repos à nos neurones après les
            festivités du nouvel an...:-))</P>
            <P align=left>Le plus important est le choix de l'image utilisée
            dans l'animation.&nbsp; Le motif doit être assez gros pour être
            visible durant les transformations. Les explications suivent dans le
            message suivant.</P>
            <P align=left>Amusez-vous bien !!!</P></TD></TR>
        <TR bgColor=#b32926>
          <TD style="FONT-SIZE: 12pt; TEXT-ALIGN: center" vAlign=bottom
          align=right>
            <P align=center><FONT size=2>Louis :-))&nbsp;<A <
          A></FONT></P></A></TD></TR></TBODY></TABLE></DIV></TD></TR></TBODY></TABLE></DIV>
 
En rouge, la couleur, largeur et type de cadre
En violet, la position de zone réservée à l'animation
En vert, la couleur du fond d'écran de la zone réservée à l'animation
<OBJECT id=DAControl
style="BORDER-RIGHT: #667637 6px ridge; BORDER-TOP: #667637 6px ridge; LEFT: 0pxBORDER-LEFT: #667637 6px ridge; WIDTH: 400px; BORDER-BOTTOM: #667637 6px ridge; POSITION: absolute; TOP: 0px; HEIGHT: 266px; BACKGROUND-COLOR: #000000"
 
Ici, le chemin de l'image qui sera utilisée pour l'animation ainsi que les dimensions de l'image...Les dimensions en mauve peuvent être différentes de celles de l'image mais elles doivent être les mêmes que celles indiquées dans la section ci-haut:
classid=CLSID:B6FFC24C-7E13-11D0-9B47-00C04FC2F51D width=400 height=266><PARAM NAME="OpaqueForHitDetect" VALUE="1"><PARAM NAME="UpdateInterval" VALUE="0.033"></OBJECT><IMG id=ttimage
style="DISPLAY: none" height=266 src="D:\CCG Lifnet\CCG19\legumes.jpg" width=400>
 
---------------------------dans cette partie, il vaut mieux ne pas toucher --------------------------
<SCRIPT>
/////////////////////////////////////
//                                 //
//         Superellipsoids         //
//   Phil Richards December 2001   //
//  evolve@p-richards.demon.co.uk  //
//      last evolved 29/12/01      //
//                                 //
/////////////////////////////////////
 
var m=DAControl.MeterLibrary;     
 
textureimg=m.ImportImage(ttimage.src).MapToUnitSquare()
 
var n1=sdan(0.1,2.5,0.08);
var n2=sdan(0.1,2.5,0.061);
var r1=sdan(0.5,1,1);
var r2=sdan(0.5,1,0.61);
var r3=sdan(0.5,1,0.11);
 
var g=superellipsoidAnim(r1,r2,r3,n1,n2,16,16);
 
g=g.DiffuseColor(m.ColorRgb255(142,225,252)).SpecularColor(m.ColorRgb255(255,255,255)).SpecularExponent(50);
g=g.TextureImage(textureimg);
 
var ggeo=g.Transform(
  m.Compose3Array(
    new Array(
      m.Scale3Uniform(0.03),
      m.Rotate3Rate(m.XVector3, 2.00),
      m.Rotate3Rate(m.ZVector3, 0.9),
      m.Rotate3Rate(m.YVector3, 1)
    )
  )              
)
 
var light0=m.AmbientLight.LightColor(m.colorRgb(.1,.1,.1));
var light1=m.DirectionalLight.Transform(m.Rotate3(m.YVector3, 1.5));
var light2=m.PointLight.Transform(m.Translate3(-1,1,3));
var lights=m.UnionGeometryArray(new Array(light1,light1,light2));
 
var camera=m.PerspectiveCamera(2.9,.799);
 
var scene=m.UnionGeometry(ggeo,lights).Render(camera);
 
DAControl.Image=scene;
DAControl.Start();
 

function superellipsoidAnim(rx,ry,rz,k1,k2,ntheta,nphi){
/////////////////////////////////////
//                                 //
//   DA SuperEllipsoid Generator   //
//    Adaptive texture version     //
//   Phil Richards December 2001   //
//  evolve@p-richards.demon.co.uk  //
//      last evolved 29/12/01      //
//                                 //
/////////////////////////////////////
//
//Produces an animated mesh which approximates the spherical
//product of two superquadratic curves. Values of k1 and k2
//control which shape is produced - spheres, cuboids,
//ellipsoids, pillows, double cones, octohedra and others
//are possible.
//
//Parameters
//rx     : DANumber, size along x-axis
//ry     : DANumber, size along y-axis
//rz     : DANumber, size along z-axis
//k1     : DANumber, z-axis squareness (suggest 0.1<=k4<=3.0)
//k2     : DANumber, x-y plane squareness (suggest 0.1<=k5<=3.0)
//ntheta : integer,  steps about x/y axis
//nphi   : integer,  steps about z axis
//
 
  var n,x,y,z,nx,ny,nz,i,j,theta,phi,nk1,nk2,sc,sn;
  var a1,a2,ct,st,pctk1,cp,sp,pctnk1,nx1,ny1;
 
  var p=new Array();
  var u=new Array();
  var norm1=new Array();
  var pos=new Array();
  var surf=new Array();
  var norm=new Array();
 
  var tx=new Array();
  var sxt=new Array();
  var syt=new Array();
  var cumdistt=new Array();
  var dxt=new Array();
  var dyt=new Array();
 
  var ty=new Array();
  var sxp=new Array();
  var szp=new Array();
  var cumdistp=new Array();
  var dxp=new Array();
  var dzp=new Array();
 
  //texture coord positions for theta=0
  cumdistt[0]=da(0);
  sxt[0]=m.Neg(rx);
  syt[0]=da(0);
  for(i=1;i<=nphi;i++){
    phi=2*i*Math.PI/nphi-Math.PI;
    sxt[i]=m.Mul(rx,powAnim(Math.cos(phi),k2));
    syt[i]=m.Mul(ry,powAnim(Math.sin(phi),k2));
    dxt[i]=m.Sub(sxt[i],sxt[i-1]);
    dyt[i]=m.Sub(syt[i],syt[i-1]);
    cumdistt[i]=m.Add(cumdistt[i-1],m.Sqrt(m.Add(m.Mul(dxt[i],dxt[i]),m.Mul(dyt[i],dyt[i]))))
  }
  for(i=0;i<=nphi;i++)tx[i]=m.Div(cumdistt[i],cumdistt[nphi]);
 
  //texture coord positions for phi=0
  cumdistp[0]=da(0);
  sxp[0]=da(0);
  szp[0]=m.Neg(rz);
  for(i=1;i<=ntheta+1;i++){
    theta=i*Math.PI/(ntheta+1)-Math.PI/2;
    sxp[i]=m.Mul(rx,powAnim(Math.cos(theta),k1));
    szp[i]=m.Mul(rz,powAnim(Math.sin(theta),k1));
    dxp[i]=m.Sub(sxp[i],sxp[i-1]);
    dzp[i]=m.Sub(szp[i],szp[i-1]);
    cumdistp[i]=m.Add(cumdistp[i-1],m.Sqrt(m.Add(m.Mul(dxp[i],dxp[i]),m.Mul(dzp[i],dzp[i]))))
  }
  for(i=0;i<=ntheta+1;i++)ty[i]=m.Div(cumdistp[i],cumdistp[ntheta+1]);
 
  //Equations of superellipsoid:
  // x = rx * cos(theta)^k1 * cos(phi)^k2
  // y = ry * cos(theta)^k1 * sin(phi)^k2
  // z = rz * sin(theta)^k1
  // -pi/2<=theta<=pi/2
  // -pi<=phi<=pi
 
  nk1=m.Sub(da(2),k1);
  nk2=m.Sub(da(2),k2);
 
  u.push(m.Point2Anim(da(0),da(0)));
  p.push(m.Point3Anim(da(0),da(0),m.Neg(rz)));
  norm1.push(m.Vector3Anim(da(0),da(0),da(-1)));
  for(i=0;i<ntheta;i++){
    theta=(i+1)*Math.PI/(ntheta+1)-Math.PI/2;// -PI/2 <= theta <= PI/2
 
    ct=Math.cos(theta);
    st=Math.sin(theta)
    pctk1=powAnim(ct,k1);
    pctnk1=powAnim(ct,nk1);
    pstnk1=powAnim(st,nk1);
    a1=m.Mul(rx,pctk1);
    a2=m.Mul(ry,pctk1);
    z=m.Mul(rz,powAnim(st,k1));
    nz=m.Div(pstnk1,rz);
    nx1=m.Div(pctnk1,rx);
    ny1=m.Div(pctnk1,ry);
 
    for(j=0;j<nphi;j++){
      phi=2*j*Math.PI/(nphi)-Math.PI;// -PI <= phi <= PI
      cp=Math.cos(phi);
      sp=Math.sin(phi);
      x=m.Mul(a1,powAnim(cp,k2));
      y=m.Mul(a2,powAnim(sp,k2));
      nx=m.Mul(nx1,powAnim(cp,nk2));
      ny=m.Mul(ny1,powAnim(sp,nk2));
      u.push(m.Point2Anim(tx[j],ty[i+1]));
      p.push(m.Point3Anim(x,y,z));
      norm1.push(m.Vector3Anim(nx,ny,nz));
    }
  }
 
  u.push(m.Point2Anim(da(0),da(1)));
  p.push(m.Point3Anim(da(0),da(0),rz));
  norm1.push(m.Vector3Anim(da(0),da(0),da(1)));
 
  //end cap
  sc=0;
  sn=1;
  for(j=0;j<nphi;j++){
    surf.push(m.Point2Anim(tx[j],ty[1]));
    norm.push(norm1[sn+j]);
    pos.push(p[sn+j]);
    surf.push(m.Point2Anim(tx[j],ty[0]));
    norm.push(norm1[sc]);
    pos.push(p[sc]);
    if(j==nphi-1){
      surf.push(m.Point2Anim(tx[j+1],ty[1]));
      norm.push(norm1[sn]);
      pos.push(p[sn]);
    }
    else{
      surf.push(m.Point2Anim(tx[j+1],ty[1]));
      norm.push(norm1[sn+j+1]);
      pos.push(p[sn+j+1]);
    }
  }
  //body
  for(i=0;i<ntheta-1;i++){
    sc=i*nphi+1;
    sn=sc+nphi;
    for(j=0;j<nphi;j++){
      surf.push(u[sn+j]);
      norm.push(norm1[sn+j]);
      pos.push(p[sn+j]);
      surf.push(u[sc+j]);
      norm.push(norm1[sc+j]);
      pos.push(p[sc+j]);
      if(j==nphi-1){
        surf.push(m.Point2Anim(da(1),ty[i+3]));
        norm.push(norm1[sn]);
        pos.push(p[sn]);
        surf.push(m.Point2Anim(da(1),ty[i+3]));
        norm.push(norm1[sn]);
        pos.push(p[sn]);
      }
      else{
        surf.push(u[sn+j+1]);
        norm.push(norm1[sn+j+1]);
        pos.push(p[sn+j+1]);
        surf.push(u[sn+j+1]);
        norm.push(norm1[sn+j+1]);
        pos.push(p[sn+j+1]);
      }
      surf.push(u[sc+j]);
      norm.push(norm1[sc+j]);
      pos.push(p[sc+j]);
      if(j==nphi-1){
        surf.push(m.Point2Anim(da(1),ty[i+3]));
        norm.push(norm1[sc]);
        pos.push(p[sc]);
      }
      else{
        surf.push(u[sc+j+1]);
        norm.push(norm1[sc+j+1]);
        pos.push(p[sc+j+1]);
      }
    }
  }
  //end cap
  sc=(ntheta-1)*nphi+1;
  sn=ntheta*nphi+1;
  for(j=0;j<nphi;j++){
    surf.push(m.Point2Anim(tx[j],ty[ntheta+1]));
    norm.push(norm1[sn]);
    pos.push(p[sn]);
    surf.push(m.Point2Anim(tx[j],ty[ntheta]));
    norm.push(norm1[sc+j]);
    pos.push(p[sc+j]);
    if(j==nphi-1){
      surf.push(m.Point2Anim(tx[j+1],ty[ntheta]));
      norm.push(norm1[sc]);
      pos.push(p[sc]);
    }
    else{
      surf.push(m.Point2Anim(tx[j+1],ty[ntheta]));
      norm.push(norm1[sc+j+1]);
      pos.push(p[sc+j+1]);
    }
  }
 
  var geo=m.TriMesh(pos.length/3,pos,norm,surf,null);
  return(geo);
}
 
function sign(n){
  var a=(n>=0)?1:-1;
  return(a);
}
 
function powAnim(a,b){
  return(m.Mul(da(sign(a)),m.Pow(da(Math.abs(a)),b)));
}
 
function da(n){
  return m.DANumber(n);
}
 
function sdan(min,max,rate){
  var a=(max-min)/2;
  var b=a+min;
  return(m.Add(m.DANumber(b),m.Mul(m.DANumber(a),m.Sin(m.Mul(m.Localtime,m.DANumber(rate))))))
}
 
</SCRIPT>
 
<SCRIPT language=JavaScript>
ScrollSpeed = 100;  // milliseconds between scrolls
ScrollChars = 2;    // chars scrolled per time period
 
 
Ici le texte qui va apparaitre au bas de l'écran:
function SetupTicker() {
  // add space to the left of the message
  msg = "     LE CCG19....MIEUX VAUX TARD QUE JAMAIS :-)). . .   ";
   RunTicker();}
 
function RunTicker() {
  window.setTimeout('RunTicker()',ScrollSpeed);
  window.status = msg;
  msg = msg.substring(ScrollChars) + msg.substring(0,ScrollChars);}
SetupTicker();
 
</SCRIPT>
 
Amusez-vous bien !!!  Il y a surement encore plein de choses à modifier que je n'ai pas encore essayé.  Chose certaine, je ne m'aventurerai pas à modifier les formules mathématiques utilisées par l'auteur.  Pour être franc, je n'y comprend absolument rien :-))))
 
Louis :-))
 
P.S.  Des remerciements à l'auteur du script...

Menu