![]() |
![]() |
Shape.Effect
Property Effect As Effect
Member of Shape
The Effect property represents the Effect object for shapes generated by an effect (for example, contour or blend groups, extrude facets, and so on).
The Effect property represents a read-only value.
The following code example creates a blend between two ellipses. It iterates through all of the shapes on the page to locate the blend group and changes some blend parameters. This example is just a demonstration of the Effect property; you can use the Effect object returned by the CreateBlend method directly if you want to set properties of the blend just created.
Sub Test() Dim doc As Document Dim e1 As Shape, e2 As Shape, s As Shape Set doc = CreateDocument Set e1 = doc.ActiveLayer.CreateEllipse(0, 0, 2, 2) e1.Fill.UniformColor.RGBAssign 255, 0, 0 Set e2 = doc.ActiveLayer.CreateEllipse(4, 4, 5, 5) e2.Fill.UniformColor.RGBAssign 0, 0, 255 e1.CreateBlend e2 For Each s In doc.ActivePage.Shapes If s.Type = cdrBlendGroupShape Then With s.Effect.Blend .Steps = 5 .ColorBlendType = cdrRainbowCWFountainFillBlend End With End If Next s End Sub
The following code example changes the blend-effect properties immediately after creating the blend. You can also set most of the parameters for the blend directly in the CreateBlend method.
Sub Test() Dim doc As Document Dim e1 As Shape, e2 As Shape, eff As Effect Set doc = CreateDocument Set e1 = doc.ActiveLayer.CreateEllipse(0, 0, 2, 2) e1.Fill.UniformColor.RGBAssign 255, 0, 0 Set e2 = doc.ActiveLayer.CreateEllipse(4, 4, 5, 5) e2.Fill.UniformColor.RGBAssign 0, 0, 255 Set eff = e1.CreateBlend(e2) eff.Blend.Steps = 5 eff.Blend.ColorBlendType = cdrRainbowCWFountainFillBlend End Sub
The next example runs more efficiently. All of the blend parameters are set in a single command.
Sub Test() Dim doc As Document Dim e1 As Shape, e2 As Shape, eff As Effect Set doc = CreateDocument Set e1 = doc.ActiveLayer.CreateEllipse(0, 0, 2, 2) e1.Fill.UniformColor.RGBAssign 255, 0, 0 Set e2 = doc.ActiveLayer.CreateEllipse(4, 4, 5, 5) e2.Fill.UniformColor.RGBAssign 0, 0, 255 e1.CreateBlend e2, 5, cdrRainbowCWFountainFillBlend End Sub
The following code example changes the number of steps in all blends found on a page and removes any extrudes found. The usefulness of the Shape.Effect property is apparent when working with many effects in an existing document.
Sub Test() Dim s As Shape For Each s In ActivePage.Shapes Select Case s.Type Case cdrExtrudeGroupShape s.Effect.Clear Case cdrBlendGroupShape s.Effect.Blend.Steps = 50 End Select Next s End Sub
![]() |
![]() |
![]() |
Copyright 2007 Corel Corporation. All rights reserved.