EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust
Scripting: Property.keyInSpatialTangent / keyOutSpatialTangent under their AE names
storybored3790a8cdfc67efb
diff --git a/crates/script/src/prelude.js b/crates/script/src/prelude.jsindex c06bc9bfa..ce048bfd4 100644--- a/crates/script/src/prelude.js+++ b/crates/script/src/prelude.js@@ -865,8 +865,8 @@ Property.prototype.property = function () { return null; };P.setTemporalAutoBezierAtKey = function (i, b) { this.__select(i); __call("keys.interpolation", { comp: this.__layer.__comp, autoBezier: !!b }); };P.keyRoving = function (i) { return !!this.__key(i).roving; };P.setRovingAtKey = function (i, b) { this.__select(i); __call("keys.interpolation", { comp: this.__layer.__comp, roving: !!b }); };- P.keySpatialInTangent = function (i) { return this.__key(i).spatialIn.slice(0, this.__info().dims); };- P.keySpatialOutTangent = function (i) { return this.__key(i).spatialOut.slice(0, this.__info().dims); };+ P.keyInSpatialTangent = function (i) { return this.__key(i).spatialIn.slice(0, this.__info().dims); };+ P.keyOutSpatialTangent = function (i) { return this.__key(i).spatialOut.slice(0, this.__info().dims); };P.keySpatialContinuous = function (i) { return !!this.__key(i).spatialContinuous; };P.keySpatialAutoBezier = function (i) { return !!this.__key(i).spatialAutoBezier; };P.setSpatialTangentsAtKey = function (i, inT, outT) {diff --git a/crates/script/src/tests.rs b/crates/script/src/tests.rsindex 4df252b6e..b5ea092ba 100644--- a/crates/script/src/tests.rs+++ b/crates/script/src/tests.rs@@ -241,6 +241,22 @@ fn keyframes_eases_and_interpolation() {assert_eq!(v[9], json!(2));}+#[test]+fn spatial_tangents_round_trip() {+ let mut s = session();+ let o = ok(+ &mut s,+ r#"+ var c = app.project.items.addComp("T", 100, 100, 1, 2, 25);+ var p = c.layers.addNull().transform.position;+ p.setValuesAtTimes([0, 1], [[0, 0], [100, 0]]);+ p.setSpatialTangentsAtKey(1, [0, 0], [30, 40]);+ [p.keyOutSpatialTangent(1)[0], p.keyOutSpatialTangent(1)[1], p.keyInSpatialTangent(1)[0]]+ "#,+ );+ assert_eq!(o.result, json!([30, 40, 0]));+}+#[test]fn text_documents() {let mut s = session();