Graphics

 View Only
  • 1.  Animating a Bar Chart - Scripting keyframes

    Posted 04-18-2013 01:11
    A scripting question - I have created a bar chart and I can adjust the scaling (width) of the bar with the code below.

    dim bar as xpBaseObject

    scene.GetObjectByName("Bar1", bar)

    bar.scaleX = cInt(text)/100


    I was asked if I could then animate the bar. I'm currently faking it using a mask that animates. I was wondering if you can take the scale value and assign it to (or create) a keyframe.

    I also work in the VizRT world and you can name keyframes in that timeline and assign values (scale, time, position, etc)

    Thanks!

    Brian


  • 2.  RE: Animating a Bar Chart - Scripting keyframes

    Posted 04-18-2013 01:56
    Brian,

    have found the easy way to do this is place the object you are scaling inside of a group object. Then animate the scale of the group from 0 to 1. That animation will stay constant while the bar inside is scaling based on your script.

    Andrew

    #XPression


  • 3.  RE: Animating a Bar Chart - Scripting keyframes

    Posted 04-18-2013 02:32
    ok, thanks Andrew. I'll check that out.

    #XPression


  • 4.  RE: Animating a Bar Chart - Scripting keyframes

    Posted 04-18-2013 08:57
    Hi Brian,

    You can do that without any problem.

    Just create a cylinder with a length of let's say 500.

    Change the Pivot-X to 250 (half of the length)

    Then create keyframes where you change the value of Scale-X.

    Done!

    The only tricky part is that you need to do some math to calculate the scale when you are using numeric values. So if you have a bar displaying percentages. 100% would be scale 1. 0% would be scale 0. And percentages are the easy ones :-) It's when you have to use actual values where it gets a bit more difficult :-)

    Best regards,

    Kenneth

    #XPression


  • 5.  RE: Animating a Bar Chart - Scripting keyframes

    Posted 04-19-2013 14:07
    Thanks Kenneth. I think we're essentially doing the same thing. My question however was more on the animation controller. Say I set 2 keyframes, one at "0" where scaleX = 0.0 and a second keyframe at "20". I was looking for a way to tell that second keyframe what the scaleX value was going to be based on the value I entered.

    -Brian

    #XPression