2016-05-08 2 views
0

Je voudrais mettre le titre + nom de l'artiste lorsque la chanson est en cours de lecture, mais je ne sais pas comment y parvenir, car avec presque 30-35 chansons, il serait être long et ennuyeux pour créer une couche de texte spécifique pour chaque chanson. S'il y a un truc pour y parvenir rapidement.(After Effects) Changer le contenu du texte au fil du temps

Répondre

1

Vous pouvez y parvenir via un script. J'ai ces deux scripts qui devraient faire ce que vous voulez. Je les ai écrits il y a quelque temps. Peut-être que vous avez besoin de faire quelques ajustements.

Celui-ci ajoute plusieurs couches de texte à partir d'un fichier csv.

https://github.com/fabiantheblind/after-effects-script-snippets/blob/master/comp_with_text.jsx

Celui-ci devrait ajouter une couche de texte avec le texte source réglé sur le contenu d'un csv.

https://github.com/fabiantheblind/after-effects-script-snippets/blob/master/text_to_comp.jsx

Ceci est un exemple minimal d'ajouter une couche de texte avec sourceText

/** 
* main function 
*/ 
var main = function() { 
    var txt = ['Hello - World', 'dog -cat', 'foo - bah']; // the text to add 
    app.beginUndoGroup('add source text'); // open a undo group 
    var curComp = app.project.activeItem; // get the current comp 
    // check if the curent active item is a comp 
    if (!curComp || !(curComp instanceof CompItem)) { 
    alert('noComp'); 
    return; 
    // end if no comp is active 
    } 
    var txtLayer = curComp.layers.addText('titles'); // add a text layer 
    var counter = 0; // the time to add a keyframe to (in seconds) 
    // loop the text 
    for (var i = 0; i < txt.length; i++) { 
    var curFrame = (counter/curComp.frameRate); // calc time for each frame 
    $.writeln(curFrame); 
    // add a keyframe with the text as value every frame 
    txtLayer.text.sourceText.setValueAtTime(curFrame, txt[i]); 
    counter++; // increase the time by one 
    } 
    app.endUndoGroup(); 
}; 
main();