필터 추가

Flash Player 9 이상, Adobe AIR 1.0 이상, Flash CS3 이상 필요

모션 트윈의 대상 객체에 필터가 들어 있는 경우 이러한 필터는 Motion 클래스의 initFilters() 및 addFilterPropertyArray() 메서드를 사용하여 추가됩니다.

필터 배열 초기화

initFilters() 메서드는 필터를 초기화합니다. 첫 번째 인수는 표시 객체에 적용된 모든 필터의 정규화된 클래스 이름이 들어 있는 배열입니다. 이 필터 이름 배열은 Flash에서 모션 트윈에 대한 필터 목록을 사용하여 생성됩니다. 스크립트 복사본에서 flash.filters 패키지의 필터를 제거하거나 이 배열에 추가할 수 있습니다. 다음 호출에서는 대상 표시 객체에 대한 필터 목록을 초기화합니다. 또한 DropShadowFilter , GlowFilter 및 BevelFilter 를 적용하고 목록을 Motion 객체의 각 키프레임에 복사합니다.
__motion_Box.initFilters(["flash.filters.DropShadowFilter", "flash.filters.GlowFilter", "flash.filters.BevelFilter"], [0, 0, 0]);

필터 추가

addFilterPropertyArray() 메서드는 다음 인수로 초기화된 필터의 속성을 나타냅니다.
  1. 첫 번째 인수는 필터를 인덱스로 식별합니다. 인덱스는 initFilters() 에 대한 이전 호출에서 전달된 필터 클래스 이름 배열에서 해당 필터 이름이 있는 위치를 나타냅니다.

  2. 두 번째 인수는 각 키프레임의 해당 필터에 대해 저장할 필터 속성입니다.

  3. 세 번째 인수는 지정된 필터 속성의 값입니다.

앞에 나온 initFilters() 호출에서 다음과 같이 addFilterPropertyArray() 를 호출하면 DropShadowFilter 의 blurX 및 blurY 속성에 값 5가 할당됩니다. DropShadowFilter 는 초기화된 필터 배열의 첫 번째 항목(인덱스 0)입니다.
__motion_Box.addFilterPropertyArray(0, "blurX", [5]); 
__motion_Box.addFilterPropertyArray(0, "blurY", [5]);
다음 세 개의 호출에서는 초기화된 필터 배열의 두 번째 항목(인덱스 1)인 GlowFilter 의 quality, alpha 및 color 속성에 값을 할당합니다.
__motion_Box.addFilterPropertyArray(1, "quality", [BitmapFilterQuality.LOW]); 
__motion_Box.addFilterPropertyArray(1, "alpha", [1.00]); 
__motion_Box.addFilterPropertyArray(1, "color", [0xff0000]);
다음 네 개의 호출에서는 초기화된 필터 배열의 세 번째 항목(인덱스 2)인 BevelFilter 의 shadowAlpha , shadowColor , highlightAlpha 및 highlightColor 에 값을 할당합니다.
__motion_Box.addFilterPropertyArray(2, "shadowAlpha", [1.00]); 
__motion_Box.addFilterPropertyArray(2, "shadowColor", [0x000000]); 
__motion_Box.addFilterPropertyArray(2, "highlightAlpha", [1.00]); 
__motion_Box.addFilterPropertyArray(2, "highlightColor", [0xffffff]);

ColorMatrixFilter를 사용한 색상 조정

ColorMatrixFilter 가 초기화된 후에는 적절한 AdjustColor 속성을 설정하여 트위닝된 표시 객체의 밝기, 대비, 채도 및 색조를 조정할 수 있습니다. 일반적으로 모션 트윈이 Flash에서 만들어진 경우 AdjustColor 필터가 적용되며 ActionScript의 복사본에서 세밀하게 조정할 수 있습니다. 다음 예제에서는 표시 객체가 이동할 때 해당 객체의 색조 및 채도를 변형합니다.

__motion_Leaf_1.initFilters(["flash.filters.ColorMatrix"], [0], -1, -1); 
__motion_Leaf_1.addFilterPropertyArray(0, "adjustColorBrightness", [0], -1, -1); 
__motion_Leaf_1.addFilterPropertyArray(0, "adjustColorContrast", [0], -1, -1); 
__motion_Leaf_1.addFilterPropertyArray(0, "adjustColorSaturation", 
    [ 
        0,-0.589039,1.17808,-1.76712,-2.35616,-2.9452,-3.53424,-4.12328, 
        -4.71232,-5.30136,-5.89041, 6.47945,-7.06849,-7.65753,-8.24657, 
        -8.83561,-9.42465,-10.0137,-10.6027,-11.1918,11.7808,-12.3699, 
        -12.9589,-13.5479,-14.137,-14.726,-15.3151,-15.9041,-16.4931, 
        17.0822,-17.6712,-18.2603,-18.8493,-19.4383,-20.0274,-20.6164, 
        -21.2055,-21.7945,22.3836,-22.9726,-23.5616,-24.1507,-24.7397, 
        -25.3288,-25.9178,-26.5068,-27.0959,27.6849,-28.274,-28.863,-29.452, 
        -30.0411,-30.6301,-31.2192,-31.8082,-32.3973,32.9863,-33.5753, 
        -34.1644,-34.7534,-35.3425,-35.9315,-36.5205,-37.1096,-37.6986, 
        38.2877,-38.8767,-39.4657,-40.0548,-40.6438,-41.2329,-41.8219, 
        -42.411,-43 
    ], 
    -1, -1); 
__motion_Leaf_1.addFilterPropertyArray(0, "adjustColorHue", 
    [ 
        0,0.677418,1.35484,2.03226,2.70967,3.38709,4.06451,4.74193,5.41935, 
        6.09677,6.77419,7.45161,8.12903,8.80645,9.48387,10.1613,10.8387,11.5161, 
        12.1935,12.871,13.5484,14.2258,14.9032,15.5806,16.2581,16.9355,17.6129, 
        18.2903,18.9677,19.6452,20.3226,21,22.4286,23.8571,25.2857,26.7143,28.1429, 
        29.5714,31,32.4286,33.8571,35.2857,36.7143,38.1429,39.5714,41,42.4286,43.8571, 
        45.2857,46.7143,48.1429,49.5714,51,54,57,60,63,66,69,72,75,78,81,84,87, 
        90,93,96,99,102,105,108,111,114 
    ], 
    -1, -1);