Rounded values of AE setValueAtTime script?

Hi guys,.

I'm just getting started with extendScript, and I ran a question.

I'm trying to set a keyframe to a value (admittedly) large, After Effects sets a value that is different from the value that I. It seems to be snapping more rounded and incoherently.

For example, the values I put in the script, and what After Effects is layer on keyframe

1248304.6823 1248304.625

-4720535.9958 - 4720536

4092748.7335 4092748.75

You can see it seems to be 'registration' values in de.025 increments, but it does so inconsistently with a value to another. Is there a setting that I can put in the script to force it to use the actual value I want?

What is strange is that if I copy and paste these values into After Effects directly on keyframes, it rounds up to 3 significant figures, as I expect.

Is it all just because my numbers are too big? And if so, why the After Effects has no problem with the values?

Ideas or ideas would be very appreciated!

for (var i = 1; i & lt; = app.project.numItems; i ++) {}

If (app.project.item (i) instanceof CompItem) {}

model var = app.project.item (i);

var textName = comp.layers.addText ('test');

textName.threeDLayer = true;

textName.position.setValueAtTime (0, [1248304.6823,-4720535.9958, 4092748.7335]);

}

}

Zewt! You are a hero!

I took an approach changed to your idea:

I put int and decimal fractions of value as the positions on two null objects.

Then I used an expression on the camera.position to combine these two values.

Finally, I used this script I linked to convert expressions camera.position in keyframes and remove NULL values.

That way I would create two distinct null objects and do not create two for each axis (x, y, z).

In addition, the control slider has a limit of 1 000 000-1 000 000 which was not enough for what I had.

For one in the future (or maybe me) who may fall on this solution.

// Creating project
var project = app.newProject();
// Creating comp
var comp = project.items.addComp('untitled', 1920, 1080, 1, 15, 30);
// Open the comp
comp.openInViewer();

// Create a camera
var cameraLayer = comp.layers.addCamera( 'Camera', [
  '${this.model.width / 2}',
  '${this.model.height / 2}'
] );

var cameraPosition  = cameraLayer.position;

var positionInts = comp.layers.addNull();
positionInts.name = 'positionInts';
positionInts.threeDLayer = true;

var positionDecimals = comp.layers.addNull();
positionDecimals.name = 'positionDecimals';
positionDecimals.threeDLayer = true;

// Set the int of all your values on the positionInts null
positionInts.position.setValuesAtTimes(
    [0, 1, 2], [
        [4518810, -71312864, -2158705],
        [4522482, -71308958, -2158292],
        [4533658, -71297341, -2157044]
    ]
);
// Set the decimal of all values on the positionDecimals null
positionDecimals.position.setValuesAtTimes(
    [0, 1, 2], [
        [0.6400621915236115, -0.80026875436306, -0.5924631282687187],
        [0.0393883166834712, -0.00048755109310150146, -0.32361961202695966],
        [0.004953828640282154, -0.6714665293693542, -0.026646549347788095]
    ]
);

// Create an expression on the camera position
cameraPosition.expression = '[ thisComp.layer("positionInts").transform.position[0] + thisComp.layer("positionDecimals").transform.position[0] , thisComp.layer("positionInts").transform.position[1] + thisComp.layer("positionDecimals").transform.position[1], thisComp.layer("positionInts").transform.position[2] + thisComp.layer("positionDecimals").transform.position[2] ];';

// Bake all the expression keyframes
function convertToKeyframes(theProperty) {
    if (theProperty.canSetExpression && theProperty.expressionEnabled) {
        theProperty.selected = true;
        app.executeCommand(app.findMenuCommandId("Convert Expression to Keyframes"));
        theProperty.selected = false;
    }
}

convertToKeyframes( cameraPosition );

Thanks again for your contribution!

Tags: After Effects

Similar Questions

  • Add a minimum value in a calculation script

    I'm working on a new form and add a minimum for a calculation script that calculates the amount of the loan, but if the calculation is <$ 175, it fills as $175 and is no less than that.

    Current script is:

    function MyRound (nValue, nDec) {}

    var nRound = util.printf ("" %, 1-1. "') + nDec + "f", nValue)

    Return Number (nRound);

    } / / end MyRound funciton.

    custom calculation script lenderstitlebase;

    lenderstitlebase = (loanamount *. 0030) circle until neareast 0;

    calculate the value;

    var lenderstitlebase = this.getField("loanamount").value * 0.0030.

    round the value;

    Event.Value = MyRound (lenderstitlebase, 1);

    Thank you!

    Add this line at the end of the code:

    If (event.value<175) event.value="">

  • rounded values in chart

    I have a multiplot xy graph with as input a range of x values and the values y of 5.8 to 6 which are doubles.

    However, once the graphic display all values there are rounded to 6.

    I guess it must be a matter of setting somewhere that the values in the chart are not integers, but I can't find it there.

    I have already changed in the graphics settings-> format and precision-> digits of precision for 8, but I still get rounded up to 6?

    Where is the magical setting for this?

    Figure autoadjusts for the type of data connected directly on it. If connect you to a local variable, you do not get this feature for good reasons.

    Most likely, you had a whole one wired to Terminal curve at some point in the past and LabVIEW who remembered.

    The first choice should always be connect directly to the Terminal. Do not think that local variables and the 'variables' in the code of the text, they are not and should not be used as such. Local variables break the flow of data, can cause race conditions, complicate debugging and force copies of additional data in memory (can be very expensive for xy charts!), so there is a big difference. Local variables should be used if there is a very good reason.

    (See also this link and many other similar discussions)

  • The rounding value

    How can I round the double value of a not given numbers fraction, Say for example: my double is 10.222222222 for this issue, I want only 10.22 and 10.899999 for that 10.90

    How can I do this task?

    I wrote getDoubleValue (double) method that rounds the fractional pats

    public static double getDoubleValue (double value) {}
    Dim str As String = String.valueOf (value);
    int index = str.indexOf ('.) ', 0) + 1 ;
    String integer = str.substring (0, index-1);
    Decimals of string = str.substring (index);
    If (decimal.length)< 4)="">
    Returns the value;
    }
    isPre boolean = true;
    int i;
    for (I = decimal.length () - 1; i > 3; i-) {}
    Val As Char = decimal.charAt (i);
    If (val > = '5' & val)<= '9')="">
    isPre = true;
    } else {}
    If (isPre & val == '4') {}
    isPre = true;
    } else {}
    isPre = false;
    }
    }
    }
    decimal = decimal.substring (0, i);
    If {(isPre)
    int val is (Integer.parseInt (decimal) + 1);.
    {if(Val>=1000)}
    Integer = String.valueOf (Integer.parseInt (Integer) + 1);
    decimal = '0 '.
    } else {}
    decimal = String.valueOf (Integer.parseInt (decimal) + 1);
    }
               
    }
    return Double.parseDouble (integer + "." + comma);
    }

  • Value returned by the script JSFL in Javascript

    Hello all, please I need your help, I have a file called loader.js, and this is my code:

    var csi=new CSInterface(); 

    function evalScript(script, callback) {

    new CSInterface().evalScript(script, callback);

    }

    var docName = evalScript('fl.getDocumentDOM().name');

    alert(jsfl);

    I want the code to display the name of a document to a flash file, and I put it on a javascript file (to create an extension of html5 to Flash CC). Unfortunately, the variable docName showing always undefined . But if I change the code to be like this:

    var docName = evalScript('fl.trace(fl.getDocumentDOM().name);');

    The code above can make the variable docName showing my 'document name' inside in the flash IDE output panel. How can I get the name of the document and put it on the variable docName (if it's possible, I don't want to load any external jsfl file). Thanks for your help and sorry for my bad English,

    "recall" must be based, so you can write as below:

    (function () {
      'use strict';
      var csInterface = new CSInterface();
      function init() {
      $("#button").click(function () {
      csInterface.evalScript('function getNm(){return fl.getDocumentDOM().name;}getNm();', function(payload){
      alert("My documents name : "+ payload);
      });
      });
      }
      init();
    }());
    

    First arg of callback as JSFL function return value (string).

  • Setting a value to kill a script

    I'm working on my first script and I hit a bit of a snag.

    I added an expression of slider to a layer which I later add an expression.  (This part works)  The first two lines in the following code work as expected.  Line one creates the effect cursor and line two changes the name of the effect to the layer name what it controls.

    Third line aimed to set the value of the cursor, but if this line is left in the script, the script simply stop at this moment, out of the loop for that is the code.  As near as I can tell, I'm trying to set a value to a ReadOnly property, but I don't know what size I should work with.  I guess that featherCrtl.property (1) is the value of the slider... Maybe it's not.  But I don't know what else would be the value.

    Any help would be greatly appreciated.

    Thank you

    Lars

    var featherCrtl = selectedLayers[i].property("Effects").addProperty("ADBE Slider Control"); 
    featherCrtl.name = selectedLayers[i].name + " Feather Control"; 
    featherCrtl.property(1).setValue(myFeather); 
    

    Yes, it's because when you add an effect to a layer, any reference to existing effects gets invalidated (some for maks, etc, IE everything that can be added).

    So when you add the "opacityCrtl", the defined variable previously 'featherCrtl' is no longer valid. You need to redefine, or do what you did, simply referring to the effect by name.

    Xavier.

  • a rounding value

    Hi all, I would like to round a value in the Sub function... but the o/p is a little different when I'm trying to round up cant someone suggest me what is the problem?
    declare 
    v_number VARCHAR2(100); 
    begin 
    v_number:=XXC_LANDED_COST_sandy('NOV612'); 
    --vnumber1:=mode(v_number,4); 
      dbms_output.put_line('p_land_cost:'|| round(v_number,1)); 
    END;
    
    SQL> /
    p_land_cost1:1.96286675243338120312749321844582734961
    p_land_cost:.1
    I don't understand why I'm getting 2values
    Thanks in advance!

    Oh, and why did you said v_number as a varchar2? It's probably a number? Especially if you are wanting to round up...

    SQL> set serverout on
    SQL> ed
    Wrote file afiedt.buf
    
      1  declare
      2    v_number NUMBER;
      3  begin
      4    v_number:=1.96286675243338120312749321844582734961;
      5    dbms_output.put_line('p_land_cost:'|| round(v_number,1));
      6* END;
    SQL> /
    p_land_cost:2
    
    PL/SQL procedure successfully completed.
    
    SQL>
    
  • Passing form field values, to an external script, in a URL

    We have a dynamic, Reader Extended form Livecyce where we have to pass two values selected by the user to an external script. The values should be passed via a URL and static entries, but needed to change can be based on user input.

    I tried variations on the following example, without success.

    Form1.Page1.button::click - (JavaScript, client)

    var userselected1;

    userselected1 = form1.page1.field1.rawValue;

    var userselected2;

    userselected2 = form1.page1.field2.rawValue;

    xfa.host.gotoURL ("http://ourdomain.com/script.php?selected1=userselected1 & selected2 = userselected2" "");

    Thank you

    Ron

    I have it! There is probably a more elegant method to achieve, but the script below works for us. A new page opens in a browser and displays information related to the variables passed to the script.

    Form1.Page1.button::click - (JavaScript, client)

    newURL1 = 'http://ourdomain.com.com/script.php?selected1=';

    newURL2 = userselected1;

    newURL3 = "& selected2 =";

    newURL4 = userselected2;

    myNewURL = newURL1 + newURL2 + newURL3 + newURL4;

    app.launchURL (myNewURL, true);

    Hope this helps someone else!

  • Show value NAN after Java Script how to remove that

    Hello

    I created a form with Page report. When I click on the ICON to change and go to the Page change, on this page, I use a Java Script

    < script >
    function servicetaxItems() {}
    function getVal (item) {}
    If ($x (point) .value! = "")
    Return parseFloat ($x (item) .value);
    on the other
    return 0;
    }
    $x('P37_SERVICE_TAX_AMT').value =.
    (getVal ('P37_SERVICE_TAX') * getVal('P37_LAB_AMT')/100);

    }
    < /script >


    I put this on the attributes of the HTML Form onBlur = "javascript:servicetaxItems()"

    Now the problem is when I go to P37_LAB_AMT and my cursor come in P37_SERVICE_TAX_AMT point then it shows NAN.
    I don't know why, it's show NAN...
    I want the calculated value in the P37_SERVICE_TAX_AMT


    How can I remove this error...

    Thank you

    Hello

    Try

    
    
  • Re: Passage of the value of the Java script

    Hello

    I would like to change the value in the text field of the java script P1_PERIOD and show the alert with the value of the P1_PERIOD
    When you press the button.

    The following code, I wrote in the button display attribute - attributes

    onclick = "JavaScript:ShowAlert (P1_PERIOD); »

    Java script:
    ---------------
    < script type = "text/javascript" >
    function ShowAlert (p_val)
    {
    Alert ('You have indexed' + p_val);
    }
    < /script >

    He's back char invalid error. Where am I wrong?

    Thanks in advance.

    Dip

    The correct call would be:

    onclick="javascript:ShowAlert($x('P1_PERIOD').value);"
    

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Opal-consulting.de/training
    http://Apex.Oracle.com/pls/OTN/f?p=31517:1
    -------------------------------------------------------------------

  • return values of PL/SQL Script Linux

    Hi gurus,

    I have a big problem...

    The following script contains two parts: a PL/SQL and Linux shell script statements.

    The PL/SQL computed value (day_id_day) and passes it to the instructions in Linux shell script (: v_salida: = day_id_day;) OUTPUT: v_salida).

    The instructions in Linux shell script to get the value (NUM_PARTICION = $?), but the value of the var day_id_day differs from the value of $NUM_PARTICION... There is no errors in the code...

    can someone help me?

    Kind regards.

    SCRIPT
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------

    $ORACLE_HOME/bin/sqlplus $ORAUSER / $ORAPASS < < eof

    Set serveroutput on;

    Number of v_salida VARIABLE;

    DECLARE
    v_error VARCHAR2 (1000);
    number of day_id_day;
    Start
    Select (sysdate + 7) sp_general_func.get_day_id
    in day_id_day
    Double;

    : v_salida: = day_id_day;

    dbms_output.put_line(:v_salida);

    end;

    /
    OUTPUT: v_salida
    expressions of folklore

    NUM_PARTICION = $?

    echo $NUM_PARTICION

    Better try this:

    ORAENV_ASK='NO'
    ORACLE_SID='ORCL'
    . oraenv
    ORAUSER='myUserid'
    ORAPASS='myPasswd'
    NUM_PARTICION=`
    $ORACLE_HOME/bin/sqlplus -s $ORAUSER/$ORAPASS <
    

    : p

  • ADF table column display rounded value

    I have a table that I created by dropping a collection on a jspx.
    He has a column of type BigDecimal. for number of records, its value is as 0.3333333333337. This is defined by the external data source. However, there is no sense for the user to see such value in this column. I want to replace this behavior and display a value as 0.33 in this column where it displays the value as 0.3333333333337 and in general that two digits after the comma.
    How is it possible in 11 1 1 5 jdev

    Hello

    You can try these options as well if you want,

    "#1 option: place a component-> operations palette Converter->""on your field of adf table where you want to cut the number and you can set it as current/number/percentage and also give the number of maximum number of digits etc... (this option is appropriate if you do not want to touch your model layer)

    #2 option: change the level ViewObject.
    Go to your view object, select the attribute and go to the tab "User interface tips", select format type = "number" and to format = "#. #;(###.##) ' (or what ever fits for you)"

    Kind regards
    Nuka ravi

    Published by: Nuka Ravi on April 8, 2013 23:22

  • using script to get the values of percentage and not able to sum up to 100%

    Hi all

    I am trying to use a parseFloat() function to convert the string value as a percentage, and then try to add all the values of %.

    but for a few scenrios even if the amount is 100% of the service I get the PctValue be <>100.00%

    the calculation of the function is as follows: -.

    code-

    {iterating_through_all_the_fields}

    PctValue += parseFloat (this.getField("Percentage1").valueAsString);

    }

    sample-

    11.12

    11.11

    11.11

    11.11

    11.11

    11.11

    11.11

    11.11

    11.11

    amount is 100

    but through code mentioned above I return 99.99

    Any help is appreciated in this regard.

    It is a result using the floating point IEEE standard and conversion from decimal to binary values values. We need to round up all the calculations of money or mils will accumulate and cause errors. For percentages, it is better to round up receipts and total final eliminate the accumulation of amounts below the figure the least significant.

    It is possible to use the util.printf of rounding.

    The following script will show what is happening:

    function Round (nValue, nDec) {}
    If (typeof nDec == "undefined") nDec = 0;
    Return number (util.printf ('%, 1 0. nDec + "f", Number (nValue)));
    }

    var nValues = new Array (11.12 11.11 11.11, 11.11, 11.11, 11.11, 11.11, 11.11, 11.11);
    nSum var = 0;
    for (var i = 0; i)< nvalues.length;="" i++="" )="">
    nSum = nSum + Round (nValues [i], 2);
    Console.println (i + "" + nValues [i] + "" + nSum);
    }
    Console.println (nSum);
    nSum = Round (nSum, 2);
    Console.println (nSum);

    Progression of the sum at each stage.
    0 11,12 11.12
    1 11.11 22.229999999999997
    2 11.11 33.339999999999996
    3 11.11 44.449999999999996
    4 11.11 55.559999999999995
    5 11.11 66.66999999999999
    6 11.11 77.77999999999999
    7 11.11 88.88999999999999
    8 11.11 99.99999999999999
    99.99999999999999
    100

    true

    It's a good idea to use decimal values a percentage and leave the determination of the field format display and the borough. But for applications of the sum, the user can round up the value of the actual field and not only display.

  • Location of the table "Data store path Selection" database and input valid value for the Round Robin

    Long history, work paths peripheral to the equivalent of "Round Robin" (VMware) programmictally change as seen in vCenter - Volume Properties-> manage-> trace selection policy paths.

    Struggling to get the value to change through scripts. Think that it requires the value as expected in the datamodel vcenter. Find it by inspecting the paintings have not yet

    Thanks in advance

    The values on the parameter - MultipathPolicy are: fixed, MostRecentlyUsed, RoundRobin, unknown

    This changes all policies to roundrobin on a specific host

    Get-VMHost  | Get-ScsiLun -LunType disk |  Set-ScsiLun -MultipathPolicy "roundrobin"
    

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • Used in forms for rule of rounding decimal values

    I am trying to determine what district to separate the rule using forms of round numbers decimal, extracted from the database to display in a shorter length field. Specifically, when a number is equidistant from its neighbours (e.g. 0.5 is equidistant between 0 and 1), which rule is used to determine if she is rounded upwards or downwards (see this for a reference of the standard rounding rules)? The online help documentation addresses rounded, but does not specify what rounding rule is used (for example half away from zero, even half or 'Banker of the borough', etc.).

    I tried to figure this out by trial and error, but make me inconsistent results. Here's my test case...

    In the two test cases:

    Database field is NUMBER (20.4)

    Form field is numeric, length 30

    Form field format mask, programmatically, set is FM999G999G999G999G999G999G999G999G999G999G999G990D90PR (i.e., round to 2 decimal places)

    The form field displays the value of the field database directly

    Test 1:

    Database field value is 1.4445

    Result: The screen displays the value as 1.44

    Test 2:

    Database field value is 1,445

    Result: The field of the screen shows the value of 1.45

    It's completely inconsistent. If 'half away from zero' or 'half of the odd' district were used, then the value 1 of the trial must be displayed as 1.45 (because the last 5 will round the previous 4 to 5 and repeat). On the other hand, if 'half zero' or 'half similarly' district were used, the value of Test 2 should be displayed as 1.44.

    I understand that the values stored in the form are not rounded, and that this will not necessarily errors of calculation. However, it is necessary for purposes of documentation that I determine what the current rule used to display rounded values.

    I use forms GR 11, 2.

    I thought about it (by another user). My hypothesis rounded is not accurate: 1.4445 would like to round up to 1.44 mathematically, not 1.45 because 1.0045 is closer to 1 than 2. Therefore, Forms uses the standard rounded technology Oracle, which is:

    1. If n is 0, then ROUND returns always 0 regardless of the integer .
    2. If n is negative, then ROUND (n, all) returns - ROUND (-n, whole).
    3. If n is positive, then ROUND (n, integer) = FLOOR (n * POWER(10, integer) + 0.5) * POWER (10, - all over)

    Source: incompatible tie rounding rule used in Oracle Forms to the decimal values - Stack Overflow

Maybe you are looking for