047_关于索引的分类

2023-02-11  本文已影响0人  孤洁大大

(1)图层的索引;



(2)数组的索引;

.positon[0]   /    .postion[1]


(3)属性的索引;

//测试属性的Index索引值

thisComp.layer("Shape Layer 1").transform.anchorPoint.propertyIndex;  // anchorPoint的索引值为1

//利用属性的索引值来 计算/显示 transform的属性值

thisComp.layer("Shape Layer 1").transform(1).value;


(4)关键帧的索引;

//"Display"文本的内容会跟"text"文本的内容完全同步

//thisComp.layer("text").text.sourceText

//"Display"文本只会显示"text"文本里第几个关键帧的内容

thisComp.layer("text").text.sourceText.key(2)  //  第2个关键帧


Index小案例演示:


同心圆的复制:

r = value[0] + index * 50; // 自定义半径=当前圆的半径值+索引值*50

[r,r]

容错处理

//小方块根据索引值进行X轴的位置偏移

x= 220 * index;

y= value[1];

[x,y]

//小方块根据偶数索引值对应的图层进行旋转30°,否则旋转0°。

try{

    if(thisComp.layer(index%2==0)){

      30;

    }

    else

    {

      0

      }

}

catch(err){

    0

}


正余弦跳动:


x = value[0] + [(index-1)*200];

y = value[1] + Math.sin(time * 2 *  Math.PI) * 100 * Math.sin(index);

[x,y]

上一篇 下一篇

猜你喜欢

热点阅读