1- /// <reference path="./types.d.ts" />
1+ type Points = Vector2D [ ] ;
2+ type Vector = [ number , number , number ?] ;
3+ type Vector2D = [ number , number ] ;
4+ type Vector3D = [ number , number , number ] ;
5+ type Color = [ number , number , number , number ] ;
6+ interface PathValue { }
7+
8+ type SourceData = any [ ] ;
29
310// Global objects, attributes, and methods
411export const PathBase : PathValue = { } ;
12+
13+ interface Key {
14+ value : Value ;
15+ time : number ;
16+ }
17+
518export const KeyBase : Key = {
619 value : "key value" ,
720 time : 0 ,
@@ -13,6 +26,60 @@ export const PointsBase: Vector2D[] = [
1326 [ 0 , 100 ] ,
1427] ;
1528
29+ interface Project {
30+ readonly fullPath : string ;
31+ readonly bitsPerChannel : "8" | "16" | "32" ;
32+ readonly linearBlending : boolean ;
33+ }
34+
35+ export const ProjectBase : Project = {
36+ fullPath : "path/to/project/file" ,
37+ bitsPerChannel : "8" ,
38+ linearBlending : true ,
39+ } ;
40+
41+ interface MarkerParam {
42+ [ id : string ] : any ;
43+ }
44+
45+ interface Marker {
46+ readonly time : number ;
47+ readonly index : number ;
48+ readonly duration : number ;
49+ readonly comment : string ;
50+ readonly chapter : string ;
51+ readonly url : string ;
52+ readonly frameTarget : string ;
53+ readonly eventCuePoint : boolean ;
54+ readonly cuePointName : string ;
55+ readonly parameters : MarkerParam ;
56+ readonly protectedRegion : boolean ;
57+ }
58+
59+ interface MarkerProperty {
60+ readonly numKeys : number ;
61+ key ( index : number | string ) : Marker ;
62+ nearestKey ( t : number ) : Marker ;
63+ }
64+
65+ interface Comp {
66+ readonly name : string ;
67+ readonly numLayers : number ;
68+ readonly activeCamera : Camera | null ;
69+ readonly width : number ;
70+ readonly height : number ;
71+ readonly duration : number ;
72+ readonly ntscDropFrame : boolean ;
73+ readonly displayStartTime : number ;
74+ readonly frameDuration : number ;
75+ readonly frameRate : number ;
76+ readonly shutterAngle : number ;
77+ readonly bgColor : Color ;
78+ readonly pixelAspect : number ;
79+ readonly marker ?: MarkerProperty ;
80+ layer ( indexOrOtherLayer : number | string | Layer , relIndex ?: number ) : Layer ;
81+ }
82+
1683export const CompBase : Comp = {
1784 name : "Comp Base" ,
1885 numLayers : 1 ,
@@ -30,10 +97,77 @@ export const CompBase: Comp = {
3097 layer : ( indexOrOtherLayer , relIndex ) => LayerBase ,
3198} ;
3299
100+ interface PropertyGroup {
101+ readonly name : string ;
102+ }
103+
33104export const PropertyGroupBase : PropertyGroup = {
34105 name : "property group base" ,
35106} ;
36- export const ValueBase = 1 ;
107+
108+ type Value =
109+ | number
110+ | Vector
111+ | Vector2D
112+ | Vector3D
113+ | String
114+ | [ ]
115+ | boolean
116+ | PathValue ;
117+
118+ export const ValueBase : Value = 1 ;
119+
120+ interface Property {
121+ readonly value : Value ;
122+ readonly name : string ;
123+ readonly velocity : number | [ ] ;
124+ readonly speed : number ;
125+ readonly numKeys : number ;
126+ readonly propertyIndex : number ;
127+ valueAtTime ( time : number ) : Value ;
128+ velocityAtTime ( time : number ) : number | [ ] ;
129+ speedAtTime ( time : number ) : number ;
130+ wiggle (
131+ freq : number ,
132+ amp : number ,
133+ octaves ?: number ,
134+ amp_mult ?: number ,
135+ time ?: number
136+ ) : Value ;
137+ temporalWiggle (
138+ freq : number ,
139+ amp : number ,
140+ octaves ?: number ,
141+ amp_mult ?: number ,
142+ time ?: number
143+ ) : Value ;
144+ smooth ( width ?: number , samples ?: number , time ?: number ) : Value ;
145+ loopIn ( type ?: loopType , numKeyframes ?: number ) : Value ;
146+ loopOut ( type ?: loopType , numKeyframes ?: number ) : Value ;
147+ loopInDuration ( type ?: loopType , duration ?: number ) : Value ;
148+ loopOutDuration ( type ?: loopType , duration ?: number ) : Value ;
149+ createPath ?(
150+ points : Points ,
151+ inTangents : Points | [ ] ,
152+ outTangent : Points | [ ] ,
153+ isClosed : boolean
154+ ) : PathValue ;
155+ key ( indexOrName : number | string ) : Key | Marker ;
156+ propertyGroup ( countUp : number ) : PropertyGroup ;
157+ }
158+
159+ interface PathProperty extends Property {
160+ points ( time ?: number ) : Vector2D [ ] ;
161+ inTangents ( time ?: number ) : Vector2D [ ] ;
162+ outTangents ( time ?: number ) : Vector2D [ ] ;
163+ isClosed ( ) : boolean ;
164+ pointOnPath ( percentage ?: number , time ?: number ) : Vector2D ;
165+ tangentOnPath ( percentage ?: number , time ?: number ) : Vector2D ;
166+ normalOnPath ( percentage ?: number , time ?: number ) : Vector2D ;
167+ }
168+
169+ type loopType = "cycle" | "pingpong" | "offset" | "continue" ;
170+
37171export const PropertyBase : PathProperty = {
38172 value : "property base string value" ,
39173 name : "property name" ,
@@ -65,6 +199,15 @@ export const PropertyBase: PathProperty = {
65199 normalOnPath : ( percentage = 0.5 , t = time ) => [ 0 , 0 ] ,
66200} ;
67201
202+ interface Transform extends PropertyGroup {
203+ anchorPoint : Property ;
204+ position : Property ;
205+ scale : Property ;
206+ rotation : Property ;
207+ orientation : Property ;
208+ rotationX ?: Property ;
209+ }
210+
68211const TransformBase : Transform = {
69212 name : "Transform" ,
70213 anchorPoint : PropertyBase ,
@@ -75,6 +218,18 @@ const TransformBase: Transform = {
75218 rotationX : PropertyBase ,
76219} ;
77220
221+ interface MaterialOptions extends PropertyGroup {
222+ lightTransmission : Property ;
223+ castShadows : Property ;
224+ acceptsShadows : Property ;
225+ acceptsLights : Property ;
226+ ambient : Property ;
227+ diffuse : Property ;
228+ specular : Property ;
229+ shininess : Property ;
230+ metal : Property ;
231+ }
232+
78233const MaterialBase : MaterialOptions = {
79234 name : "Material Property Group" ,
80235 lightTransmission : PropertyBase ,
@@ -88,25 +243,101 @@ const MaterialBase: MaterialOptions = {
88243 metal : PropertyBase ,
89244} ;
90245
246+ interface Effects extends PropertyGroup { }
247+
248+ interface Masks extends PropertyGroup { }
249+
250+ interface SourceRect {
251+ readonly top : number ;
252+ readonly left : number ;
253+ readonly width : number ;
254+ readonly height : number ;
255+ }
256+
91257export const SourceRectBase : SourceRect = {
92258 top : 0 ,
93259 left : 0 ,
94260 width : 100 ,
95261 height : 100 ,
96262} ;
97263
264+ interface Effect {
265+ active : boolean ;
266+ param ( nameOrIndex : string | number ) : Property ;
267+ }
268+
98269export const EffectBase : Effect = {
99270 active : true ,
100271 param : ( nameOrIndex ) => PropertyBase ,
101272} ;
102273
274+ interface Mask {
275+ maskOpacity : Property ;
276+ maskFeather : Property ;
277+ maskExpansion : Property ;
278+ invert : boolean ;
279+ }
280+
103281export const MaskBase : Mask = {
104282 maskOpacity : PropertyBase ,
105283 maskExpansion : PropertyBase ,
106284 maskFeather : PropertyBase ,
107285 invert : false ,
108286} ;
109287
288+ interface Light {
289+ pointOfInterest : Vector3D ;
290+ intensity : number ;
291+ color : Color ;
292+ coneAngle : number ;
293+ coneFeather : number ;
294+ shadowDarkness : number ;
295+ shadowDiffusion : number ;
296+ }
297+
298+ interface Camera { }
299+
300+ interface Layer {
301+ readonly name : string ;
302+ readonly source ?: Comp | Footage ;
303+ readonly width : number ;
304+ readonly height : number ;
305+ readonly index : number ;
306+ readonly parent ?: Layer | Light | Camera ;
307+ readonly hasParent : boolean ;
308+ readonly inPoint : number ;
309+ readonly outPoint : number ;
310+ readonly startTime : number ;
311+ readonly hasVideo : boolean ;
312+ readonly hasAudio : boolean ;
313+ readonly active : boolean ;
314+ readonly enabled : boolean ;
315+ readonly audioActive ?: boolean ;
316+ readonly audioLevels ?: Property ;
317+ readonly timeRemap ?: Property ;
318+ readonly marker ?: MarkerProperty ;
319+ transform ?: Transform ;
320+ materialOption ?: MaterialOptions ;
321+ toComp ( vec : Vector , time ?: number ) : Vector ;
322+ fromComp ( vec : Vector , time ?: number ) : Vector ;
323+ toWorld ( vec : Vector , time ?: number ) : Vector ;
324+ toCompVec ( vec : Vector , time ?: number ) : Vector ;
325+ fromCompVec ( vec : Vector , time ?: number ) : Vector ;
326+ toWorldVec ( vec : Vector , time ?: number ) : Vector ;
327+ fromWorldVec ( vec : Vector , time ?: number ) : Vector ;
328+ fromCompToSurface ( vec : Vector ) : Vector ;
329+ sourceTime ?( time ?: number ) : number ;
330+ sourceRectAtTime ( time ?: number , includeExtents ?: boolean ) : SourceRect ;
331+ effect ( nameOrIndex : number | string ) : Effect ;
332+ mask ( nameOrIndex : number | string ) : Mask ;
333+ sampleImage (
334+ point : Vector2D ,
335+ radius ?: Vector2D ,
336+ postEffect ?: boolean ,
337+ time ?: number
338+ ) : Color ;
339+ }
340+
110341export const LayerBase : Layer = {
111342 name : "layer base" ,
112343 source : CompBase ,
@@ -151,6 +382,22 @@ export function comp(index: number | string) {
151382export const time : number = 0 ;
152383export const colorDepth : number = 8 ;
153384
385+ interface Footage {
386+ readonly name : string ;
387+ readonly width ?: number ;
388+ readonly height ?: number ;
389+ readonly duration ?: number ;
390+ readonly frameDuration ?: number ;
391+ readonly ntscDropFrame ?: boolean ;
392+ readonly pixelAspect ?: number ;
393+ readonly sourceText ?: string ;
394+ readonly sourceData ?: SourceData [ ] ;
395+ dataValue ?( dataPath : [ ] ) : number ;
396+ dataKeyCount ?( dataPath : [ ] ) : number ;
397+ dataKeyTimes ?( dataPath : [ ] , t0 ?: number , t1 ?: number ) : number [ ] ;
398+ dataKeyValues ?( dataPath : [ ] , t0 ?: number , t1 ?: number ) : number [ ] ;
399+ }
400+
154401const FootageBase : Footage = {
155402 name : "Footage Item" ,
156403 width : 1920 ,
0 commit comments