Graphics

 View Only
  • 1.  Equal distribution of quad

    Posted 10-09-2022 05:17
    hi there
    Three quads are equally distributed on the canvas.  When one of the quads disappears,  the remaining two quads are equally distributed on the canvas.
    Besides, there is a silky moving animation.
    1 or 0 controls the hide and display of quad
    How to do it


    ------------------------------
    alan
    ------------------------------


  • 2.  RE: Equal distribution of quad

    Ross Staff
    Posted 10-09-2022 12:20
    Do you mean that when you hide quad 3 it animations to the new position or is a jump ok?

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



  • 3.  RE: Equal distribution of quad

    Posted 10-09-2022 22:42
    Hide any quad,Not just quad3.
    When one of the quads is hidden, the remaining two quads will have a  moving animation
    that is evenly distributed on the canvas

    ------------------------------
    alan
    ------------------------------



  • 4.  RE: Equal distribution of quad

    Ross Staff
    Posted 10-10-2022 09:17
      |   view attached
    I wrote this onto a text object that's connected to the vis of all three added together so any time 1 of the turns invisible it will trigger the others to animate. 

    Here is the script however I have also attached the project for you to look at. 

    dim q1, q2, q3 as xpQuadObject
    dim sd as xpSceneDirector
    dim track as xpSceneDirectorTrack
    dim cp as xpSceneDirectorClip
    dim anim as xpAnimController


    scene.GetSceneDirectorByName("Mover", sd)
    sd.Position = 0
    scene.GetAnimControllerByName("MOVE", anim)
    scene.DeleteAnimController(anim)
    scene.CreateAnimController(anim)
    sd.GetTrackByName("Track1", track)
    track.CreateAnimClip(0,anim,cp)
    anim.Name = "MOVE"


    scene.GetObjectByName("Quad1", q1)
    scene.GetObjectByName("Quad2", q2)
    scene.GetObjectByName("Quad3", q3)

    if q1.Visible = true

    else
    dim q2Pos as integer
    q2Pos = q2.PosX
    dim q3Pos as integer
    q3Pos = q3.PosX
    anim.Duration = 50
    anim.SetKeyFrameValueTCB(q2, 0, "Position.X", q2Pos, 0, 0, 0)
    anim.SetKeyFrameValueTCB(q2, 50, "Position.X", 580, 1, 0, 0)
    anim.SetKeyFrameValueTCB(q3, 0, "Position.X", q3Pos, 0, 0, 0)
    anim.SetKeyFrameValueTCB(q3, 50, "Position.X", 1340.000, 1, 0, 0)
    sd.Play()
    sd.AutoStop = true

    end if

    if q2.Visible = true

    else
    dim q1Pos as integer
    q1Pos = q1.PosX
    dim q3Pos as integer
    q3Pos = q3.PosX
    anim.Duration = 50
    anim.SetKeyFrameValueTCB(q1, 0, "Position.X", q1Pos, 0, 0, 0)
    anim.SetKeyFrameValueTCB(q1, 50, "Position.X", 580, 1, 0, 0)
    anim.SetKeyFrameValueTCB(q3, 0, "Position.X", q3Pos, 0, 0, 0)
    anim.SetKeyFrameValueTCB(q3, 50, "Position.X", 1340.000, 1, 0, 0)
    sd.Play()
    sd.AutoStop = true

    end if

    if q3.Visible = true

    else
    dim q1Pos as integer
    q1Pos = q1.PosX
    dim q2Pos as integer
    q2Pos = q2.PosX
    anim.Duration = 50
    anim.SetKeyFrameValueTCB(q1, 0, "Position.X", q1Pos, 0, 0, 0)
    anim.SetKeyFrameValueTCB(q1, 50, "Position.X", 580, 1, 0, 0)
    anim.SetKeyFrameValueTCB(q2, 0, "Position.X", q2Pos, 0, 0, 0)
    anim.SetKeyFrameValueTCB(q2, 50, "Position.X", 1340.000, 1, 0, 0)
    sd.Play()
    sd.AutoStop = true

    end if

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

    Attachment(s)

    xpf
    ThreeQuads.xpf   30 KB 1 version


  • 5.  RE: Equal distribution of quad

    Posted 10-11-2022 02:42

    Thanks Red, but after I open the project, there is no display effect, "Mover" is empty,
    and AnimController1 and 2 have no animation
    (I am version 7.0) Is it because of the lower version?


    ------------------------------
    alan
    ------------------------------



  • 6.  RE: Equal distribution of quad

    Ross Staff
    Posted 10-11-2022 04:13
    No, mover will be empty the script deletes it and key frames are created by the script so everything will be empty. 

    I should have said, this will not work in layout. 

    You should open the project, change nothing and go to sequence, with the visibility on on all 3 objects take it online, then turn one of the objects visibility off and take again you will see it animate, turning the visibility back on and taking again will make it reset. 

    Do not touch anything in layout before going to sequence.

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



  • 7.  RE: Equal distribution of quad

    Posted 10-12-2022 06:05
    I did as you said, but it didn't work. I cried  (╥﹏╥)

    ------------------------------
    alan
    ------------------------------



  • 8.  RE: Equal distribution of quad

    Ross Staff
    Posted 10-12-2022 06:15
    I did some tests, yes the solution I wrote will not work on your version. 

    Some of the things I used in the script are not available in version 7.0.

    Are you in a position to upgrade?

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



  • 9.  RE: Equal distribution of quad

    Posted 10-13-2022 05:53
    Yes, I'll think about it

    ------------------------------
    alan
    ------------------------------