Creating Filled Shapes Dynamically

Tạo động các Shapes điền Mặc dù chúng tôi sẽ không cống hiến một bài tập cho chủ đề này, bản vẽ đầy hình dạng vẫn còn giá trị thảo luận. Bằng cách xây dựng trên cú pháp bạn đã sử dụng vậy, đến nay trong bài học này, bạn có thể sử dụng các phương pháp vẽ để tạo ra một hình dạng và sau đó điền nó với một màu duy nhất (một điền phẳng) hoặc một gradient (một điền gradient). . | Creating Filled Shapes Dynamically Even though we re not going to devote an exercise to the topic drawing filled shapes is still worth discussing. By building on the syntax you ve used thus far in this lesson you can use the drawing methods to create a shape and then fill it with a single color a flat fill or a gradient a gradient fill . To create a flat fill you must let Flash know that the shape you re about to draw will be filled. You do this by employing the following method color alpha The path points to the timeline where the lines will exist. The color parameter accepts a hex color value. The alpha parameter accepts a number between 0 and 100 to set the alpha level of the fill. To let Flash know when you re finished drawing a shape use the following method The following example shows how this method is used box_mc 1 with lineStyle 0 0x000000 100 beginFill 0x990000 100 moveTo 0 0 lineTo 100 0 lineTo 100 100 lineTo 0 100 lineTo 0 0 endFill This ActionScript does the following 1. Creates an empty movie clip instance. 2. Sets the line style. 3. Initiates the fill. 4. Draws a shape. 5. Ends the fill. It s important to note that when creating a filled shape the starting point of the shape as defined by moveTo must also be the ending point of the shape as defined by the last lineTo . Creating a gradient fill is a little more difficult than creating a flat fill. You must first tell Flash that the shape you re about to draw is to be filled with a gradient. The syntax is as follows type colors alphas ratios matrix The type parameter accepts the string linear or radial. The colors parameter is an array of hex color values that you want to use in your gradient. This array can contain two or more elements. The alphas parameter is an array of alpha values to be applied to each respective color. This array should have the same number of elements as the colors array. The ratios .

Bấm vào đây để xem trước nội dung
TÀI LIỆU MỚI ĐĂNG
513    2    1    24-05-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.