よろよろ帳

InDesign JavaScript 勉強中

ランダムカラー(文字)

Variex | Adobe Fonts

1回再生でgif書き出しは無限ループになる?

ランダムカラーの文字バージョンです。文字かテキストフレーム選んで実行。

app.doScript (main, ScriptLanguage.JAVASCRIPT, [], UndoModes.FAST_ENTIRE_SCRIPT);
function main (){
var sel=app.activeDocument.selection[0].characters;
var len=sel.length;
if(app.selection[0].constructor.name=="TextFrame"){
    app.selection=sel[0];
    app.select(SelectAll.ALL)
    }
app.panels.item('$ID/Color').visible=true;
app.menuActions.itemByID(29189).invoke();//CMYK
var rc=[];//色用
for(var i=0; i<len; i++){
    C=getRandomI(0,100);
    M=getRandomI(0,100);
    Y=getRandomI(0,100);
    K=getRandomI(0,10);
    rc.push([C,M,Y,K])
    }
for(var i=0; i<len; i++){
    sel[i].fillColor.colorValue=[rc[i][0],rc[i][1],rc[i][2],rc[i][3]];
    sel[i].select();
    app.cut();
    app.pasteInPlace();
    }
app.select(app.selection[0].parentTextFrames[0])
}
function getRandomI(min, max) {
  min=Math.ceil(min);
  max=Math.floor(max);
  return Math.floor(Math.random()*(max-min+1)+min);
}

Photoshopで動画ファイルからGIFアニメを作る完全ガイド | ギズモード・ジャパン
↑参考(QuickTimePlayerの画面収録からgif書き出し)前回はスクリーンショットを重ねたのでした。