Graphics

 View Only
  • 1.  SetKeyframeValue help

    Posted 01-23-2023 16:49

    I'm working on a banner that I'd like to have dynamically scale via Transition Logic.  The banner changes width based on the length of a textbox, and the goal is to have it expand and shrink when going back-to-back with another quad revealing the text.  The ending Position.X of the revealing quad should match the width of the banner.  I'm currently stuck getting that quad's Position.X to update using SetKeyFrameValue (I have a scene director that I'd like to update a keyframe with that value).  The script is below.  Any help is appreciated!  Thank you.

     

    'script to set banner elements

    engine.DebugMessage("****START SET X POSITION SCRIPT****",0)

     

    dim objPlate, objMask as xpBaseObject

    dim animText as xpAnimController

    dim animKey as xpKeyFrame

    dim varFrame as integer


    'retrieve scene objects

    Scene.GetObjectByName("Plate Main", objPlate)

    Scene.GetObjectByName("Plate Mask", objMask)

    Scene.GetAnimControllerByName("Text WIPE", animText)

         animText.GetKeyFrame(objMask, "Position.X", 30, animKey)

    engine.DebugMessage("Objects Retrieved",0)

     

    'set x position based on banner plate scale

    engine.DebugMessage("Current Mask X Position = " & animKey.Value,0)

    engine.DebugMessage("Current Plate Width = " & Text,0)

     

    If Text = "0.850" Then

         varFrame = -849

         engine.DebugMessage("Condition A",0)

    Else If Text = 1 Then

         varFrame = -660

         engine.DebugMessage("Condition B",0)

    End If

     

    animText.SetKeyFrameValue(objMask, 30, "Position.X", CDbl(varFrame))


    engine.DebugMessage("New Mask X Position = " & animKey.Value,0)

    engine.DebugMessage("****END SET X POSITION SCRIPT****",0)

     



    ------------------------------
    John Robbins
    Graham Media Group INC
    ------------------------------


  • 2.  RE: SetKeyframeValue help

    Posted 01-27-2023 17:37
    Update on this... received some excellent tips from Jeff Rietman from Ross regarding the use of xpAnimController in OnBeforeOnline.  I built a couple of masks that will adjust the banner width (based on the length of a text box) and height (based on if a second line IsEmpty or not).  The mask for width is animating, but the height is not.  Wondering if I'm using the proper syntax here.  Any tips is appreciated!  THank you.

    'script to create scene director animation and animate mask b2b
    engine.DebugMessage("****START BANNER ON BEFORE ONLINE SCRIPT****",0)

    'declare variables
    dim objMaskLeftOLD, objMaskLeftNEW, objMaskBottomOLD, objMaskBottomNEW as xpBaseObject
    dim aniMask as xpAnimController
    dim FB as xpOutputFrameBuffer
    dim sceneOut as xpScene

    'retrieve new scene objects
    Engine.GetOutputFrameBuffer(FramebufferIndex,FB)
    Self.GetObjectByName("Mask Plate Left", objMaskLeftNEW)
    Self.GetObjectByName("Mask Plate Bottom", objMaskBottomNEW)

    'compare old and new scenes and set banner masks
    If FB.GetSceneOnLayer(Layer,sceneOut) Then

    sceneOut.GetObjectByName("Mask Plate Left", objMaskLeftOLD)
    sceneOut.GetObjectByName("Mask Plate Bottom", objMaskBottomOLD)

    'create animation controller
    Self.CreateAnimController(aniMask)

    'set starting key frames based on old Mask Left PosX and Mask Bottom PosY
    aniMask.SetKeyFramePosition(objMaskLeftNEW,0,objMaskLeftOLD.PosX,objMaskLeftOLD.PosY,objMaskLeftOLD.PosZ,3,1)
    aniMask.SetKeyFramePosition(objMaskBottomNEW,0,objMaskBottomOLD.PosX,objMaskBottomOLD.PosY,objMaskBottomOLD.PosZ,3,1)

    'set ending key frames based on new Mask Left PosX and Mask Bottom PosY
    aniMask.SetKeyFramePosition(objMaskLeftNEW,30,objMaskLeftNEW.PosX,objMaskLeftNEW.PosY,objMaskLeftNEW.PosZ,3,1)
    aniMask.SetKeyFramePosition(objMaskBottomNEW,30,objMaskBottomNEW.PosX,objMaskBottomNEW.PosY,objMaskBottomNEW.PosZ,3,1)
    aniMask.Play

    End If

    engine.DebugMessage("****END BANNER ON BEFORE ONLINE SCRIPT****",0)​​

    ------------------------------
    John Robbins
    Graham Media Group INC
    ------------------------------