Graphics

 View Only
Expand all | Collapse all

Setting Keyframes for a Slab Width and Height

  • 1.  Setting Keyframes for a Slab Width and Height

    Posted 04-26-2023 18:07

    I have a slab object with rounded corners. I use visual logic to adjust the width and height of the object (not scale) based on text bounding box values.  I'm curious on what scripting syntax is available to scale the width and height of this slab so I can transition between a scene already online and one in preview.

    This must be width and height and not scale X and Y becuase scaling with X/Y not keep the corners in proportion. Only the width and height do that, and for the life of me, I can seem to find the syntax to keyframe those properties.

    Many thanks



    ------------------------------
    Adam Gordon
    Off the Post Productions
    ------------------------------


  • 2.  RE: Setting Keyframes for a Slab Width and Height

    Posted 04-27-2023 10:24

    In the Xpression folder is an SDK help file. This lists all the various objects and methods that you can exploit using scripting. Look through the tutorials for one by Jeff Reitman. He explains it in depth and it really helped me out.



    ------------------------------
    Malcolm Thorpe
    Free Lance Xpression Designer/Carbonite TD
    ------------------------------



  • 3.  RE: Setting Keyframes for a Slab Width and Height

    Posted 04-27-2023 10:34

    Thanks for the reply.  I actually have looked through the SDK file multiple times.  I have tried just about every posible KeyFrame Method including slab-specific methods...none worked.  Wondering if width and height are controllable through keyframing and animation controllers.  Again thanks for weighing in with the suggestion.



    ------------------------------
    Adam
    Off the Post Productions
    ------------------------------



  • 4.  RE: Setting Keyframes for a Slab Width and Height

    Posted 04-27-2023 10:39

    If you use xpQuadObject rather than xpBaseObject you'll find properties like width and height. 



    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------



  • 5.  RE: Setting Keyframes for a Slab Width and Height

    Posted 04-27-2023 10:41

    This also works for slab :)



    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------



  • 6.  RE: Setting Keyframes for a Slab Width and Height

    Posted 04-27-2023 10:53

    Thanks Red.  So my orginal question stems bask to scripting syntax....maybe I am not communicating my question correctly.

    Here's a sample script on what I am trying to do

    dim objSlabOnline, objSlabNew as xpSalbObject
    dim animSlab as xpAnimController
    dim FB as xpOutputFrameBuffer
    dim onlineScene as xpScene
     
    Engine.GetOutputFrameBuffer(FramebufferIndex,FB)
    Self.GetObjectByName("Slab1", objSlabNew)
    'compare old and new scenes and set banner masks
    If FB.GetSceneOnLayer(Layer,onlineScene) Then
     
    onlneScene.GetObjectByName("Slab1", objSlabOnline)
    'create animation controller
    Self.CreateAnimController(animSlab)
     
    'Here, I want to get the updated width and height of my slab object in preview...ready to air for starting keyframe
    animSlab.SetKeyFrame(objSlabNew,0,objSlabOnline.width,objSlabOnline.Height,3,1)
    'set ending key frames based on new slab width and height
    animSlab.SetKeyFramePosition(objSlabNew,30,objSlabNew.Width,objSlabNew.Height,3,1)

    animSlab.Play
     
    End If

    Hope this makes sense on what I am trying to do.  Thanks Red.



    ------------------------------
    Adam
    Off the Post Productions
    ------------------------------



  • 7.  RE: Setting Keyframes for a Slab Width and Height

    Posted 04-27-2023 11:15

    You're not setting any heigh or with values in that string though? 

    Here's an example from one of my scripts,

    anim.SetKeyFramePosition(txGrp,0,0,0,0)
    anim.SetKeyFrameValueTCB(txGrp, 250, "Position.X", 0, 1, 0, 0)
    anim.SetKeyFrameValueTCB(txGrp, endFrame, "Position.X", 1380-xVal, 1, 0, 0)



    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------



  • 8.  RE: Setting Keyframes for a Slab Width and Height

    Posted 04-27-2023 11:27

    I will play with that.  I see you are keyframing the positions...I am trying to keyfrme width values between the online scene and the incoming scene.  

    I'll see if your script can translate to that.

    Many thanks



    ------------------------------
    Adam
    Off the Post Productions
    ------------------------------



  • 9.  RE: Setting Keyframes for a Slab Width and Height

    Posted 04-27-2023 11:27

    Hi Adam, this thread might help you on how to format a script for animation. 

    https://livinglive.community/communities/community-home/digestviewer/viewthread?MessageKey=97062078-e543-462e-9c07-8430786db772&CommunityKey=91812bfd-9393-4a3f-8a74-7f8035df130



    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------



  • 10.  RE: Setting Keyframes for a Slab Width and Height

    Posted 04-27-2023 11:49

    Thank you for this.  Will look it over and digest...probably over a large bottle of Cab.

    Cheers



    ------------------------------
    Adam
    Off the Post Productions
    ------------------------------



  • 11.  RE: Setting Keyframes for a Slab Width and Height

    Posted 04-27-2023 11:55

    No worries, they thing is either get an existing anim from a track or if you create one you're going to need to put it somewhere. 

    I don't want to confuse things but here's a script I wrote that decides if something should be a ticker and if its a ticker should it tick or if its to long should it crawl and then tick. 

    But you'll see the principle of what I am doing getting scene directors, scene directors tracks, anim directors and deleting, placing them etc. 

     dim OgText, targetText, Total, Count as xpTextObject
     
        Scene.GetObjectByName("FldA",OgText)
        Scene.GetObjectByName("TICK_FldA",targetText)
    Scene.GetObjectByName("Total",Total)
    Scene.GetObjectByName("Count",Count)
     
        dim arr() as string = split(OgText.text,"|")
     
        targetText.text = arr(0)
     
    'engine.debugmessage(arr.length,0)
     
    Total.Text = arr.length
    Count.Text = 1
     
     
    dim sd as xpSceneDirector
    dim tr as xpSceneDirectorTrack
    dim cp, res as xpSceneDirectorClip
    dim anim as xpAnimController
    dim txGrp as xpBaseObject
     
    'Get Text Groups
    scene.GetObjectByName("TICKER GRP", txGrp)
     
    'clean out old anim keyframes
    scene.GetSceneDirectorByName("Ticker_Crawl", sd)
    sd.Position = 0
    scene.GetAnimControllerByName("TICKER_CRAWL", anim)
    scene.DeleteAnimController(anim)
     
    'name crawl place on track
    scene.CreateAnimController(anim)
    anim.Name = "TICKER_CRAWL"
    sd.GetTrackByName("Track1", tr)
    tr.CreateAnimClip(0,anim,cp)
     
    'get restart trigger
    sd.GetTrackByName("Track2", tr)
    tr.GetClipByName("Restart", res)
     
    dim xVal as String = targetText.boundingbox.width
    'engine.DebugMessage(xVal, 0)
    if xVal < 1701 then
    'DON"T ANIMATE TICKER
    'engine.DebugMessage("Don't Animate Ticker", 0)
    sd.PlayRange(0, 510)
    res.Position = 500
    txGrp.PosX = 0
    else
    'ANIMATE TICKER
    'engine.DebugMessage("Animate Ticker", 0)
    dim endFrame as integer
    endFrame = xVal / 2
    anim.Duration = endFrame
    anim.SetKeyFramePosition(txGrp,0,0,0,0)
    anim.SetKeyFrameValueTCB(txGrp, 250, "Position.X", 0, 1, 0, 0)
    anim.SetKeyFrameValueTCB(txGrp, endFrame, "Position.X", 1380-xVal, 1, 0, 0)
    sd.PlayRange(0, endframe +20)
    sd.AutoStop = true
    res.Position = endFrame + 10
    'engine.DebugMessage("res pos" & res.Position, 0)
    end if ' end of crawl script


    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------



  • 12.  RE: Setting Keyframes for a Slab Width and Height

    Posted 04-27-2023 12:32

    This just came to my memory. I had pill shaped L3 super backgrounds that had to size. I cut the pill in half vertically and applied each half to a separate material layer and I could then modify the material position in the quad. Can you design your slab in photoshop and size it that way?



    ------------------------------
    Malcolm Thorpe
    Free Lance Xpression Designer/Carbonite TD
    ------------------------------



  • 13.  RE: Setting Keyframes for a Slab Width and Height

    Posted 04-27-2023 14:27

    Yeah, my other preference in the past has been to design the ends using 2 slabs and attach them using visual logic. Then just size a quad as normal. 



    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------



  • 14.  RE: Setting Keyframes for a Slab Width and Height

    Posted 04-27-2023 14:52
    These are great ideas.  I will play around with them.  I like these ideas a lot.  

    Many thanks to you both.