Consulting

Results 1 to 4 of 4

Thread: Animate star through shapes outline/border in powerpoint vba

  1. #1
    Banned VBAX Regular
    Joined
    Sep 2020
    Location
    https://t.me/pump_upp
    Posts
    15
    Location

    Animate star through shapes outline/border in powerpoint vba

    Sir,
    I need some help.
    I want to animate a star through any powerpoint shapes(here decagon) outline/border using vba code.
    I make an animation for referance & giving custom path through outline/border of the decagon shape manually.


    Dim effNew As Effect
    Dim aniMotion As AnimationBehavior

    ' Add custom effect to the shape


    Set effNew = ActivePresentation.Slides(1).TimeLine.MainSequence _
    .AddEffect(Shape:=Star5Points1, effectId:=msoAnimEffectCustom, _
    Trigger:=msoAnimTriggerWithPrevious)

    ' Add Motion effect
    Set aniMotion = effNew.Behaviors.Add(msoAnimTypeMotion)

    ' Set Motion Path as custom path ie outline of shape
    aniMotion.MotionEffect.Path = string


    I cannot configure this "aniMotion.MotionEffect.Path = string"
    section ie string = ????
    Attached Files Attached Files

  2. #2
    there is a sample of what you like here?
    https://docs.microsoft.com/en-us/off...t.motioneffect

  3. #3
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    You are trying to do something which is very difficult! Do you have a good knowledge of vba?

    Anyway here are some hints.#

    #1 start by adding a motion path NOT a custom animation
    #2 use a VML path not move To etc and change the path of the animation added.

    EXAMPLE to move in rectangle shape

    Sub RECT()
    Dim oeff As Effect
    Dim oshp As Shape
    Set oshp = ActiveWindow.Selection.ShapeRange(1)
    'add existing motion path type
    Set oeff = ActivePresentation.Slides(1).TimeLine.MainSequence.AddEffect(oshp, msoAnimEffectPathRight)
    'Adapt opath
    oeff.Behaviors(1).MotionEffect.Path = "M 0.0000,0.0000 L 0.2000 0.0000 L 0.2000 0.2000 L 0.0000 0.2000 L 0.0000 0.0000 Z"
    End Sub

    Explaination of Path

    M 0.0000 0.0000 Motion Path from current position
    L 0.2000 0.0000 Move in Line .2 of slide width right
    L 0.2000 0.2000 Line to .2 of slide width across and .2 of slide height down
    L 0.0000 0.2000 Line to original left position and .2 of slide height down
    L 0.0000 0.0000 Back to start


    If you can't' work out how to apply it to another shape I'm afraid you are on your own! I don't have time to do it for you
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  4. #4
    Banned VBAX Regular
    Joined
    Sep 2020
    Location
    https://t.me/pump_upp
    Posts
    15
    Location
    Thanks Sir

    Got the idea. But its very difficult for me to implement in other Powerpoint shape.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •