LouiZeForum
Would you like to react to this message? Create an account in a few clicks or log in to continue.
LouiZeForum

3D vrml
 
HomeHome  SearchSearch  Latest imagesLatest images  RegisterRegister  Log in  3Dchats / forums3Dchats / forums  
Le Deal du moment :
TCL C74 Series 55C743 – TV 55” 4K QLED 144 ...
Voir le deal
499 €

 

 Tutorial (ProxVisMovieTexture)

Go down 
AuthorMessage
Findescarrotte
+1000
+1000



Number of posts : 1956
Registration date : 2007-06-19

Tutorial (ProxVisMovieTexture) Empty
PostSubject: Tutorial (ProxVisMovieTexture)   Tutorial (ProxVisMovieTexture) EmptySat 3 Nov - 17:14

Comment créer une animation sens passé par un fichier GIF , je me suis penché sur le question et trouver une solution , un script proto qui fonctionne nikelle .

Placer le code en début de page

Code:
#VRML V2.0 utf8
PROTO ProxVisMovieTexture [
            eventIn      SFBool set_enabled
            eventOut    SFBool isActive
            exposedField MFString      url    [  ]
            field        SFTime cycleInterval  1
          ]
{
  DEF mt_0 ImageTexture {
    url IS url
  }
  DEF mt_clock_1 TimeSensor {
    isActive IS isActive
    startTime  0
    stopTime    0
    cycleInterval IS cycleInterval
    loop        TRUE
  }
  DEF mt_script_2 Script {
    eventIn      SFBool set_enabled IS set_enabled
    eventIn      SFFloat        set_fraction
    eventOut    SFTime startTime_changed
    eventOut    SFTime stopTime_changed
    eventOut    MFString      img_changed
    field        MFString      img    IS url
    field        SFInt32        index  0
    field        SFFloat        div    1
    url "vrmlscript:
function set_enabled(v,t){
 if(v){ startTime_changed = t;
        print('start');
 }
 else{
  stopTime_changed =t;
  print('stop');
 }
}



function set_fraction(v,t){

 ii = Math.floor(v/div);
 if(ii != index){
  index ++;
  if(index >= img.length){index = 0;}
  img_changed = new MFString(img[ii]);
 }
}

function initialize(){
 //stopTime_changed = Browser.getWorldStartTime();
 
 div = 1 / img.length;
 
 }

"
  }
  ROUTE mt_script_2.img_changed TO mt_0.set_url
  ROUTE mt_script_2.startTime_changed TO mt_clock_1.set_startTime
  ROUTE mt_script_2.stopTime_changed TO mt_clock_1.set_stopTime
  ROUTE mt_clock_1.fraction_changed TO mt_script_2.set_fraction
}


Et a votre texture comme ceci !! , il n'y a pas de limite au nombre d'image , remplace ( texture imageTexture ) par :

Code:
texture ProxVisMovieTexture {
url ["a2.jpg","a3.jpg","a4.jpg","a5.jpg","a1.jpg"]
cycleInterval 0.5
}

cycleInterval 0.5 est la vitesse par image
Back to top Go down
 
Tutorial (ProxVisMovieTexture)
Back to top 
Page 1 of 1
 Similar topics
-
» Spazz / Vizx3D / FluxStudio
» Seamless
» REAL 3D STEREO
» Streaming-Tutorial
» Vivaty Tutorial

Permissions in this forum:You cannot reply to topics in this forum
LouiZeForum :: ARTS :: 3D art :: Script-
Jump to: