Flex Gumbo中如何通过x,y属性设置LinearGradientStroke线性斜度坐标位置的例子

By Minidxer | June 18, 2009

接下来的例子演示了Flex Gumbo中如何通过x,y属性,设置LinearGradientStroke线性斜度坐标位置。

让我们先来看一下Demo可以点击这里察看源代码):


下面是完整代码(或点击这里察看):

Download: main.mxml
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <Application name="LinearGradientStroke_x_test"
  3.         xmlns="http://ns.adobe.com/mxml/2009"
  4.         layout="vertical"
  5.         verticalAlign="middle"
  6.         backgroundColor="white">
  7.  
  8.     <ApplicationControlBar dock="true">
  9.         <Form styleName="plain">
  10.             <FormItem label="x:">
  11.                 <HSlider id="xSlider"
  12.                         minimum="-100"
  13.                         maximum="100"
  14.                         value="0"
  15.                         snapInterval="1"
  16.                         tickInterval="25"
  17.                         liveDragging="true" />
  18.             </FormItem>
  19.             <FormItem label="y:">
  20.                 <HSlider id="ySlider"
  21.                         minimum="-100"
  22.                         maximum="100"
  23.                         value="0"
  24.                         snapInterval="1"
  25.                         tickInterval="25"
  26.                         liveDragging="true" />
  27.             </FormItem>
  28.             <FormItem label="rotation:">
  29.                 <HSlider id="rotationSlider"
  30.                         minimum="-360"
  31.                         maximum="360"
  32.                         value="0"
  33.                         snapInterval="1"
  34.                         tickInterval="45"
  35.                         liveDragging="true" />
  36.             </FormItem>
  37.         </Form>
  38.     </ApplicationControlBar>
  39.  
  40.     <Graphic>
  41.         <Rect id="rect" width="300" height="200">
  42.             <stroke>
  43.                 <LinearGradientStroke id="linearGrad"
  44.                         x="{xSlider.value}"
  45.                         y="{ySlider.value}"
  46.                         rotation="{rotationSlider.value}"
  47.                         weight="5">
  48.                     <GradientEntry color="red" />
  49.                     <GradientEntry color="white" />
  50.                     <GradientEntry color="blue" />
  51.                 </LinearGradientStroke>
  52.             </stroke>
  53.         </Rect>
  54.     </Graphic>
  55.  
  56. </Application>
代码:Peter deHaan 翻译/整理/编译:中文Flex例子

Topics: Gumbo, LinearGradientStroke | No Comments » | Tags: , , , , , , , ,

Search Posts