shading a triangle (3-vertex gradient)
there triangle movie clip vertices (0, 0); b (256, 0); c (0, 256)
each vertex has color (e.g., - red, b - green, c - blue).
i need shade entire area of triangle interpolating between these 3 colors.
something gradient, has 3 vertices, not 2 linear one.
i tried 2 ways:
1) create 256x256 bitmapdata, attach clip , shade triangle in bitmap,
manually (just people programming 3d graphics before opengl&direct3d).
this works, slow (of course).
2) create 2x2 or 3x3 or other lilttle square bitmap, shade scale 256x256
with smoothing option (attachbitmap's argument) enabled. works quite fast , looks
right not quite right.
i thought on how accomplish gradient (maybe several gradients), no ideas...
you can check out code at: http://heilong.oceanography.ru/flash/lab/
each vertex has color (e.g., - red, b - green, c - blue).
i need shade entire area of triangle interpolating between these 3 colors.
something gradient, has 3 vertices, not 2 linear one.
i tried 2 ways:
1) create 256x256 bitmapdata, attach clip , shade triangle in bitmap,
manually (just people programming 3d graphics before opengl&direct3d).
this works, slow (of course).
2) create 2x2 or 3x3 or other lilttle square bitmap, shade scale 256x256
with smoothing option (attachbitmap's argument) enabled. works quite fast , looks
right not quite right.
i thought on how accomplish gradient (maybe several gradients), no ideas...
you can check out code at: http://heilong.oceanography.ru/flash/lab/
hey - couldn't open fla (i'm running mx 2004 - i'm guessing
have 8) might not work. it'll depend on how you're creating
triangle.
anyway, if create 3 triangles (with exact dimensions) on 3 separate
layers, colour each triangle radial gradient goes
colour white alpha setting of 0, when 3 layers overlap
exactly, triangle looks pretty good. i've uploaded sample here:
http://www.inlets.net/test/triangle/triangle.swf
the fla here:
http://www.inlets.net/test/triangle/triangle.zip
hope helps.
"heilong" <webforumsuser@macromedia.com> wrote in message
news:e4fbg9$7nr$1@forums.macromedia.com...
> there triangle movie clip vertices (0, 0); b (256, 0); c (0,
> 256)
> each vertex has color (e.g., - red, b - green, c - blue).
> need shade entire area of triangle interpolating between
> these 3 colors.
> gradient, has 3 vertices, not 2 linear one.
>
> tried 2 ways:
> 1) create 256x256 bitmapdata, attach clip , shade
> triangle in
> bitmap,
> manually (just people programming 3d graphics before
> opengl&direct3d).
> works, slow (of course).
> 2) create 2x2 or 3x3 or other lilttle square bitmap, shade
> scale 256x256
> smoothing option (attachbitmap's argument) enabled. works quite
> fast
> , looks
> right not quite right.
>
> thought on how accomplish gradient (maybe several
> gradients), no ideas...
> can check out code at: <a target=_blank
> class=ftalternatingbarlinklarge
> href=" http://heilong.oceanography.ru/flash/lab/">http://heilong.oceanography.ru/
> flash/lab/</a>
>
have 8) might not work. it'll depend on how you're creating
triangle.
anyway, if create 3 triangles (with exact dimensions) on 3 separate
layers, colour each triangle radial gradient goes
colour white alpha setting of 0, when 3 layers overlap
exactly, triangle looks pretty good. i've uploaded sample here:
http://www.inlets.net/test/triangle/triangle.swf
the fla here:
http://www.inlets.net/test/triangle/triangle.zip
hope helps.
"heilong" <webforumsuser@macromedia.com> wrote in message
news:e4fbg9$7nr$1@forums.macromedia.com...
> there triangle movie clip vertices (0, 0); b (256, 0); c (0,
> 256)
> each vertex has color (e.g., - red, b - green, c - blue).
> need shade entire area of triangle interpolating between
> these 3 colors.
> gradient, has 3 vertices, not 2 linear one.
>
> tried 2 ways:
> 1) create 256x256 bitmapdata, attach clip , shade
> triangle in
> bitmap,
> manually (just people programming 3d graphics before
> opengl&direct3d).
> works, slow (of course).
> 2) create 2x2 or 3x3 or other lilttle square bitmap, shade
> scale 256x256
> smoothing option (attachbitmap's argument) enabled. works quite
> fast
> , looks
> right not quite right.
>
> thought on how accomplish gradient (maybe several
> gradients), no ideas...
> can check out code at: <a target=_blank
> class=ftalternatingbarlinklarge
> href=" http://heilong.oceanography.ru/flash/lab/">http://heilong.oceanography.ru/
> flash/lab/</a>
>
More discussions in Adobe Animate CC - General
adobe
Comments
Post a Comment