-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Добавлен keyReverse, найден planeResolve, поправлены какие-то ошибки …
…и косяки
- Loading branch information
Nik Ska
committed
May 25, 2015
1 parent
04183c6
commit f157b3c
Showing
5 changed files
with
121 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
//ReverseKeys just does what it says is does - reverses keyframes | ||
//Just select a bunch of keyframes and the script will reverse them at the playhead | ||
|
||
//CC-BY, Nik Ska, 2015 | ||
|
||
var reverseKeys = this; | ||
|
||
reverseKeys.go = function() { | ||
var activeComp = app.project.activeItem; | ||
if(activeComp && activeComp instanceof CompItem){ | ||
var sel = activeComp.selectedLayers; | ||
if(sel.length > 0){ | ||
app.beginUndoGroup("reversing keys"); | ||
|
||
|
||
for(var l = 0; l < sel.length; l++){ | ||
thisLayer = sel[l]; | ||
|
||
if(thisLayer.selectedProperties.length > 0){ | ||
for(var p = 0; p < thisLayer.selectedProperties.length; p++){ | ||
thisProperty = thisLayer.selectedProperties[p]; | ||
|
||
//if there are more than 1 keyframes selected | ||
if(thisProperty.selectedKeys.length > 1){ | ||
var keys = thisProperty.selectedKeys; | ||
|
||
|
||
var newKeyTime = activeComp.time; | ||
for (var k = 0; k < keys.length; k++) { | ||
|
||
//creating a new key | ||
var newKeyIndex = thisProperty.addKey(newKeyTime); | ||
|
||
//getting spatial and temporal ease values | ||
var newKeyInSpatialTangent = thisProperty.keyInSpatialTangent(keys[keys.length - k - 1]); | ||
var newKeyOutSpatialTangent = thisProperty.keyOutSpatialTangent(keys[keys.length - k - 1]); | ||
|
||
var newKeyInTemporalEase = thisProperty.keyInTemporalEase(keys[keys.length - k - 1]); | ||
var newKeyOutTemporalEase = thisProperty.keyOutTemporalEase(keys[keys.length - k - 1]); | ||
|
||
//setting both value and tangents / easing | ||
thisProperty.setValueAtKey(newKeyIndex, thisProperty.keyValue(keys[keys.length - k - 1])); | ||
thisProperty.setSpatialTangentsAtKey(newKeyIndex, newKeyOutSpatialTangent, newKeyInSpatialTangent) | ||
thisProperty.setTemporalEaseAtKey(newKeyIndex, newKeyOutTemporalEase, newKeyInTemporalEase) | ||
|
||
//updating time | ||
if(k < keys.length - 1){ | ||
newKeyTime += thisProperty.keyTime(keys[keys.length - k - 1]) - thisProperty.keyTime(keys[keys.length - k - 2]); | ||
} | ||
} | ||
} | ||
} | ||
|
||
} | ||
} | ||
|
||
app.endUndoGroup(); | ||
|
||
} | ||
} | ||
} | ||
|
||
reverseKeys.go(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
//MixIt! Remixes layers based on thier position | ||
//CC-BY, Nik Ska, 2015 | ||
|
||
|
||
var activeComp = app.project.activeItem; | ||
if(activeComp && activeComp instanceof CompItem){ | ||
var sel = activeComp.selectedLayers; | ||
if(sel.length > 0){ | ||
|
||
app.beginUndoGroup("Remix"); | ||
var posArray = []; | ||
|
||
//creating anchor point - pos array | ||
for(var s = 0; s < sel.length; s++){ | ||
posArray.push([sel[s].property("ADBE Transform Group").property("ADBE Anchor Point").value, sel[s].property("ADBE Transform Group").property("ADBE Position").value]); | ||
} | ||
|
||
var i = posArray.length; | ||
|
||
while(i > 0){ | ||
var rand = parseInt(Math.random()*i); //getting random index | ||
|
||
//setting its pos and ap | ||
sel[i-1].property("ADBE Transform Group").property("ADBE Anchor Point").setValue(posArray[rand][0]); | ||
sel[i-1].property("ADBE Transform Group").property("ADBE Position").setValue(posArray[rand][1]); | ||
|
||
posArray.splice(rand, 1); | ||
|
||
i--; | ||
} | ||
|
||
app.endUndoGroup(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
Plane Resolve is a script to find a fourth point based on position of three points | ||
Assumption: | ||
*/ | ||
|
||
var alpha, beta, gamma, delta; | ||
var A_0, B_0, C_0, D_0, M_0; //initial states | ||
var A, B, C, D, M; //current states | ||
var refFrame = 0; | ||
|
||
A = | ||
B = | ||
C = | ||
D = | ||
|
||
//Добавить везде _0 | ||
var M = [0,0]; | ||
M[1] = ((A[1]*(C[0] - A[0])/(C[1] - A[1])) - (B[1]*((D[0] - B[0])/(D[1] - B[1]))) - (A[0] - B[0]))/(((C[0] - A[0])/(C[1] - A[1])) - ((D[0] - B[0])/(D[1] - B[1]))); | ||
M[0] = ((M[1] - A[1])/(C[1] - A[1]))*(C[0] - A[0]) + A[0]; |