Share via


RotationEffect.By Property

PowerPoint Developer Reference

Sets or returns a Single that represents the rotation of an object by the specified number of degrees; for example, a value of 180 means to rotate the object by 180 degrees. Read/write.

Syntax

expression.By

expression   A variable that represents a RotationEffect object.

Remarks

The specified object will be rotated with the center of the object remaining in the same position on the screen.

If both the By and To properties are set for a rotation effect, then the value of the By property is ignored.

Floating point numbers (for example, 55.5) are valid, but negative numbers are not.

Do not confuse this property with the ByX or ByY properties of the ScaleEffect and MotionEffect objects, which are only used for scaling or motion effects.

Example

This example adds a rotation effect and changes its rotation.

Visual Basic for Applications
  Sub AddAndChangeRotationEffect()
    Dim effBlinds As Effect
    Dim tmlnShape As TimeLine
    Dim shpShape As Shape
    Dim animBehavior As AnimationBehavior
    Dim rtnEffect As RotationEffect
'Sets shape, timing, and effect
Set shpShape = ActivePresentation.Slides(1).Shapes(1)
Set tmlnShape = ActivePresentation.Slides(1).TimeLine
Set effBlinds = tmlnShape.MainSequence.AddEffect _
    (Shape:=shpShape, effectId:=msoAnimEffectBlinds)

'Adds animation behavior and sets rotation effect
Set animBehavior = tmlnShape.MainSequence(1).Behaviors _
    .Add(Type:=msoAnimTypeRotation)
Set rtnEffect = animBehavior.RotationEffect
rtnEffect.<strong>By</strong> = 270

End Sub

See Also