SharePoint Development from a Documentation Perspective

Andrew May

Animating Shapes in PowerPoint 2000 and 97 (Part 3 of 4)

Animating Shapes in PowerPoint 2000 and 97 (Part 3 of 4)

  • Comments 1

Today, we talking about build effects. If you’re just joining us, you can find the first two parts of this series here and here.

Creating Build Animation Effects for Text and Charts

As mentioned earlier, you can create a special type of animation effect for text and chart objects. For these types of shapes, you can specify a build animation, in which sub-objects of the shape are animated sequentially so that they combine, or build, to display the complete shape. For example, suppose you have a single text box that contains five bullet points. You can specify that each bullet point enter the slide individually.

Use the ChartUnitEffect property for chart shapes, or the TextLevelEffect property for text boxes, to specify a Shape object’s build level; this refers to the lowest level of sub-objects at which you want to assign the effect. For example, for a text box effect with a build level of ppAnimateBySecondLevel, each first and second level bullet point, or paragraph, would be animated separately. Third, fourth, and fifth level paragraphs would be animated at the same time as the second level paragraph above them.

By default, the ChartUnitEffect property is set to ppAnimateByChartAllAtOnce, and the TextLevelEffect property is set to ppAnimateByLevelNone.

In addition, for text you can use the TextUnitEffect property to specify the level at which you want PowerPoint to animate the text within each paragraph: by character, word, or paragraph. By default, the TextUnitEffect property is set to ppAnimateByParagraph.

Finally, you can use the AnimateTextInReverse property to have PowerPoint animate your text build in reverse order, last point first, first point last. For example, if you constructed a slide listing the top ten reasons for something, or the top ten finalists in a contest, you might want to display the list in reverse order.

The following example creates a new slide in the active presentation, and adds a title and three paragraphs, or bullet points. The code sets the title to be animated character-by-character, and uses a color scheme to set the dim color for the title once its animation concludes. For the body text, the code sets the build level to the first level, meaning that the second level paragraph appears on the slide at the same time as the first level paragraph above it. The code also sets the dim color for the body text paragraphs.

With ActivePresentation.Slides.Add(2, ppLayoutText).Shapes

    With .Item(1)

        .TextFrame.TextRange.Text = "Title"

        With .AnimationSettings

            .Animate = msoTrue

            .TextLevelEffect = ppAnimateByAllLevels

            .TextUnitEffect = ppAnimateByCharacter

            .AfterEffect = ppAfterEffectDim

            .DimColor.SchemeColor = ppShadow

        End With

    End With

    With .Item(2)

        With .TextFrame.TextRange

            .Text = "This is the first level heading" & vbCrLf

            .InsertAfter "This is the second level heading" & vbCrLf

            .InsertAfter "This is another first level heading"

            .Paragraphs(1, 1).IndentLevel = 1

            .Paragraphs(2, 1).IndentLevel = 2

            .Paragraphs(3, 1).IndentLevel = 1

        End With

        With .AnimationSettings

            .Animate = msoTrue

            .TextLevelEffect = ppAnimateByFirstLevel

            .AfterEffect = ppAfterEffectDim

            .DimColor.RGB = RGB(100, 150, 130)

        End With

    End With

End With

To determine if a given shape is a chart, placeholder or text box, use the Type property of the Shape object. This property returns an MsoShapeType constant, such as MsoChart, or MsoPlaceholder or MsoTextBox. Placeholder shapes contain a PlaceholderFormat child object, which in turn includes a Type property that identifies what kind of placeholder the shape is.

Assigning Indent Levels to Text

Because you assign build effects to a shape’s text based on the indent levels of the text paragraphs, such as first-level, second-level, etc., it’s worth discussing how to specify the indent level for text.

Each Shape has a TextFrame object, which in turn has a TextRange object that contains all the text in that shape. You can then use various methods of the TextRange object to return other TextRange objects that represent various subset of the text in the shape, such as paragraphs, sentences, lines, runs, words, or characters. The IndentLevel property of a given TextRange returns or sets the indent level assigned to that text.

You can specify one indent level per paragraph. If you assign an indent level to a text range that is a sub-set of a paragraph, such as a single sentence or character run, that indent level is applied to the entire paragraph. If you assign an indent level to a text range that encompasses text in multiple paragraphs, then each of those paragraphs is assigned the specified indent level. For example, if you change the indent level of a sentence, word, or run in a second-level paragraph to 3, then the indent level for the entire paragraph is set to 3.

Because the objects returned by the various TextRange methods are TextRange objects themselves, they have all the methods and properties of that type. For example, TextFrame.TextRange.Paragraphs.Count returns the number of paragraphs contained in a shape’s text frame. Use the Paragraphs method to set the indent level of your paragraphs.

The following code example adds four paragraphs, or bullet points, to a shape on a slide. It then uses the Paragraphs method to individually return and set the indent level of each of those paragraphs.

With objShape.TextFrame.TextRange

  .Text = "This is the first level heading" & vbCrLf

  .InsertAfter "This is the second level heading" & vbCrLf

  .InsertAfter "This is the third level heading" & vbCrLf

  .InsertAfter "This is another first level heading"

  .Paragraphs(1, 1).IndentLevel = 1

  .Paragraphs(2, 1).IndentLevel = 2

  .Paragraphs(3, 1).IndentLevel = 3

  .Paragraphs(4, 1).IndentLevel = 1

End With

Tomorrow we’ll talk about setting media objects and OLE objects to perform as part of their animation effects. And if you’re good, maybe I’ll throw in some object model diagrams as well.

Page 1 of 1 (1 items)