fading Color

Boris Gaertner Boris.Gaertner at gmx.net
Mon Sep 30 15:14:01 UTC 2002


Chris Burkert <christian.burkert at s2000.tu-chemnitz.de> wrote:



> Hi
>
> I'm searching for a way to fill a Morph with more than one Color.
> I hope 'fading Color' describes it well. The best example is the
> MoviePlayer from the Widgetsflap but I didn't find how to get this
> working. Can you help me ?
>
> Regards
>             Chris Burkert
> --
Chris,

have a look at MPEGMoviePlayerMorph>>moviePlayerFillStyle.
and search the senders of this method.

The point is that you have to define a GradientFillStyle. Such a thing
has an array of colors.  Try this for different values of direction (100 @
0,
100 at 50,  100 @ 100) to get a feeling for fading coloring:

   |  fill bc |

   fill _ GradientFillStyle ramp: {
            0.0 -> (Color r: 0.05 g: 0.5 b: 1.0).  "blue"
            0.5 -> (Color r: 0.70 g: 0.85 b: 1.0). "almost white"
            1.0 -> (Color r: 0.05 g: 0.5 b: 1.0)}. "blue again"
   fill origin: (50 at 0);
        direction: 100 at 0;
        radial: false.
   bc := BalloonCanvas extent: (200 @ 100) depth: 32.
   bc fillRectangle: (0 at 0 extent: 200 @ 100)
      fillStyle: fill.

  bc form displayAt: 10@ 10

 Hope this helps





More information about the Squeak-dev mailing list