163 lines
10 KiB
JavaScript
163 lines
10 KiB
JavaScript
/* Editable offline After Effects composition. The game runtime remains MASM. */
|
||
(function () {
|
||
app.beginSuppressDialogs();
|
||
var root = File($.fileName).parent.parent.parent.fsName.replace(/\\/g, "/");
|
||
var work = root + "/build/cinematic-v3";
|
||
var source = root + "/assets/sprites/intro/";
|
||
function log(s) {
|
||
try { var f = new File(work + "/ae-build.log"); f.open("a"); f.writeln(s); f.close(); } catch (e) {}
|
||
}
|
||
function prop(layer, name) {
|
||
var p = layer.property("ADBE Transform Group").property(name);
|
||
if (!p && name === "ADBE Point of Interest") p = layer.property("ADBE Transform Group").property("ADBE Anchor Point");
|
||
return p;
|
||
}
|
||
function animate(p, times, values, soft) {
|
||
if (!p) throw new Error("Missing animated property: " + $.stack);
|
||
for (var i = 0; i < times.length; i++) p.setValueAtTime(times[i], values[i]);
|
||
if (soft) for (var j = 1; j <= p.numKeys; j++) {
|
||
try {
|
||
var count = p.isSpatial ? 1 : (p.value instanceof Array ? p.value.length : 1);
|
||
var a = [], b = [];
|
||
for (var k = 0; k < count; k++) { a.push(new KeyframeEase(0, 55)); b.push(new KeyframeEase(0, 55)); }
|
||
p.setTemporalEaseAtKey(j, a, b);
|
||
} catch (e) {}
|
||
}
|
||
}
|
||
function image(name) {
|
||
var item = app.project.importFile(new ImportOptions(new File(source + name)));
|
||
try { item.mainSource.alphaMode = AlphaMode.STRAIGHT; } catch (e) {}
|
||
return item;
|
||
}
|
||
function layer3(comp, item, name, pos, scale) {
|
||
var l = comp.layers.add(item); l.name = name; l.threeDLayer = true; l.motionBlur = true;
|
||
prop(l, "ADBE Position").setValue(pos);
|
||
prop(l, "ADBE Scale").setValue([scale, scale, scale]);
|
||
try { l.property("ADBE Material Options Group").property("ADBE Accepts Lights").setValue(0); } catch (e) {}
|
||
return l;
|
||
}
|
||
function effect(l, name, properties) {
|
||
try {
|
||
var fx = l.property("ADBE Effect Parade").addProperty(name);
|
||
for (var k in properties) try { fx.property(k).setValue(properties[k]); } catch (e) {}
|
||
return fx;
|
||
} catch (e) { log("Effect unavailable: " + name); return null; }
|
||
}
|
||
function disc(comp, name, x, y, radius, color, opacity, blur) {
|
||
var l = comp.layers.addShape(); l.name = name;
|
||
var g = l.property("ADBE Root Vectors Group").addProperty("ADBE Vector Group");
|
||
var c = g.property("ADBE Vectors Group");
|
||
c.addProperty("ADBE Vector Shape - Ellipse").property("ADBE Vector Ellipse Size").setValue([radius*2, radius*2]);
|
||
c.addProperty("ADBE Vector Graphic - Fill").property("ADBE Vector Fill Color").setValue(color);
|
||
prop(l, "ADBE Position").setValue([x,y]); prop(l, "ADBE Opacity").setValue(opacity);
|
||
l.blendingMode = BlendingMode.ADD;
|
||
effect(l, "ADBE Gaussian Blur 2", {"ADBE Gaussian Blur 2-0001": blur});
|
||
return l;
|
||
}
|
||
function bars(comp) {
|
||
var top = comp.layers.addSolid([0,0,0], "Cinema matte / upper",1280,64,1,comp.duration);
|
||
prop(top, "ADBE Position").setValue([640,32]);
|
||
var bottom = comp.layers.addSolid([0,0,0], "Cinema matte / lower",1280,64,1,comp.duration);
|
||
prop(bottom, "ADBE Position").setValue([640,928]);
|
||
}
|
||
try {
|
||
app.newProject();
|
||
app.project.bitsPerChannel = 16;
|
||
var wheel = image("roulette-cinematic-v1.png");
|
||
var logo = image("eblan-cinematic-v2.png");
|
||
var cards = image("cards-cinematic-v3.png");
|
||
var chips = image("chips-cinematic-v3.png");
|
||
var studio = app.project.items.addComp("01 / EBLAN GAMES - Table fly-through",1280,960,1,8,30);
|
||
studio.motionBlur = true; studio.shutterAngle = 210; studio.motionBlurSamplesPerFrame = 12;
|
||
studio.layers.addSolid([.006,.012,.014],"Noir background",1280,960,1,8);
|
||
var pool = disc(studio,"Broad amber table light",700,800,490,[.38,.17,.035],38,160);
|
||
var cold = disc(studio,"Teal edge light",100,300,400,[.015,.19,.21],35,170);
|
||
var w = layer3(studio,wheel,"Engraved roulette / tilted table",[680,960,700],130);
|
||
prop(w,"ADBE Rotate X").setValue(44);
|
||
animate(prop(w,"ADBE Rotate Z"),[0,8],[18,-150],false);
|
||
animate(prop(w,"ADBE Opacity"),[0,3.1,4.8,8],[100,100,40,25],true);
|
||
log("Wheel ready");
|
||
var c = layer3(studio,cards,"Ivory aces / near left",[125,510,-430],47);
|
||
prop(c,"ADBE Rotate Y").setValue(20); prop(c,"ADBE Rotate Z").setValue(-11);
|
||
animate(prop(c,"ADBE Position"),[0,3.8,8],[[125,510,-430],[-290,640,-250],[-510,790,-180]],true);
|
||
var ch = layer3(studio,chips,"Clay chips / near right",[1250,800,-510],47);
|
||
prop(ch,"ADBE Rotate Y").setValue(-16);
|
||
animate(prop(ch,"ADBE Position"),[0,4.2,8],[[1250,800,-510],[1460,850,-380],[1570,920,-220]],true);
|
||
var far = layer3(studio,chips,"Distant chip stacks",[470,850,460],37);
|
||
prop(far,"ADBE Rotate Y").setValue(14);
|
||
var brand = layer3(studio,logo,"Sculpted studio title / focal plane",[640,430,-30],78);
|
||
animate(prop(brand,"ADBE Opacity"),[0,3.25,4.7,7.4,8],[0,0,100,100,0],true);
|
||
animate(prop(brand,"ADBE Position"),[3.25,5.5,8],[[640,470,80],[640,430,-30],[640,425,-30]],true);
|
||
log("Props and logo ready");
|
||
var cam = studio.layers.addCamera("35mm / dolly and focus pull",[640,480]);
|
||
cam.autoOrient = AutoOrientType.CAMERA_OR_POINT_OF_INTEREST;
|
||
animate(prop(cam,"ADBE Position"),[0,2.6,5.3,8],[[-130,340,-980],[390,390,-1190],[640,450,-1690],[655,450,-1780]],true);
|
||
animate(prop(cam,"ADBE Point of Interest"),[0,2.6,5.3,8],[[470,630,130],[630,590,110],[640,445,0],[640,445,0]],true);
|
||
log("Camera transforms ready");
|
||
var opt = cam.property("ADBE Camera Options Group");
|
||
opt.property("ADBE Camera Zoom").setValue(1550);
|
||
opt.property("ADBE Camera Depth of Field").setValue(1);
|
||
opt.property("ADBE Camera Aperture").setValue(32);
|
||
opt.property("ADBE Camera Blur Level").setValue(80);
|
||
animate(opt.property("ADBE Camera Focus Distance"),[0,2.4,4.8,8],[1240,1460,1700,1780],true);
|
||
// Stable, authored dust. No random values at render time.
|
||
for (var i=0;i<34;i++) {
|
||
var x=(i*193)%1280, y=(i*311)%820+70;
|
||
var d=disc(studio,"Dust / "+(i+1),x,y,1+(i%3),[.8,.57,.27],12+(i%5)*4,2+i%3);
|
||
animate(prop(d,"ADBE Position"),[0,8],[[x,y],[x+100+(i%4)*20,y-45]],false);
|
||
}
|
||
var flare=disc(studio,"Warm reveal bloom",680,350,170,[.9,.49,.16],0,100);
|
||
animate(prop(flare,"ADBE Opacity"),[3.6,4.3,5.1],[0,18,0],true);
|
||
var txt=studio.layers.addText("П Р Е Д С Т А В Л Я Е Т"); txt.name="Presents / final hold";
|
||
var td=txt.property("ADBE Text Properties").property("ADBE Text Document").value;
|
||
td.font="Consolas";td.fontSize=18;td.fillColor=[.7,.68,.6];td.justification=ParagraphJustification.CENTER_JUSTIFY;
|
||
txt.property("ADBE Text Properties").property("ADBE Text Document").setValue(td);
|
||
prop(txt,"ADBE Position").setValue([640,844]);
|
||
animate(prop(txt,"ADBE Opacity"),[0,5.6,6.2,7.4,8],[0,0,100,100,0],true);
|
||
bars(studio);
|
||
|
||
var nativeOptions=new ImportOptions(new File(work+"/native-city/city_0000.png"));
|
||
nativeOptions.sequence=true; nativeOptions.forceAlphabetical=true;
|
||
var cityFootage=app.project.importFile(nativeOptions);cityFootage.name="Production MASM city / 20 fps";
|
||
cityFootage.mainSource.conformFrameRate=20;
|
||
var city=app.project.items.addComp("02 / ASSEMBLER CASINO - Rain and neon",1280,960,1,12,30);
|
||
city.motionBlur=true;city.shutterAngle=180;city.frameBlending=true;
|
||
var street=city.layers.add(cityFootage);street.name="Native city / camera bank";
|
||
street.motionBlur=true;street.frameBlendingType=FrameBlendingType.FRAME_MIX;
|
||
animate(prop(street,"ADBE Scale"),[0,4.7,8.5,12],[[212,212],[220,220],[211,211],[209,209]],true);
|
||
animate(prop(street,"ADBE Rotate Z"),[0,4.7,7.8,10,12],[-1.8,1.5,-.8,0,0],true);
|
||
// Neon already contains authored bloom; retain crisp native city detail.
|
||
// Out-of-focus foreground lights move at a different depth from the street.
|
||
for (var j=0;j<9;j++) {
|
||
var b=disc(city,"Rain-lit foreground bokeh / "+(j+1),-140,180+j*65,24+(j%3)*21,j%2?[.85,.26,.08]:[.04,.29,.34],0,45+j*4);
|
||
var enter=.7+j*.63;
|
||
animate(prop(b,"ADBE Position"),[enter,enter+1.8],[[-180,160+j*65],[1460,225+j*58]],false);
|
||
animate(prop(b,"ADBE Opacity"),[0,enter,enter+.45,enter+1.3,enter+1.8,12],[0,0,9+(j%3)*4,9+(j%3)*4,0,0],true);
|
||
}
|
||
var cityGlow=disc(city,"Neon arrival / warm flare",850,420,270,[.64,.18,.025],0,140);
|
||
animate(prop(cityGlow,"ADBE Opacity"),[0,7.6,8.4,9.2,12],[0,0,12,0,0],true);
|
||
bars(city);
|
||
var master=app.project.items.addComp("MASTER / Assembler Casino opening v3",1280,960,1,20,30);
|
||
master.motionBlur=true;
|
||
var one=master.layers.add(studio);one.startTime=0;one.outPoint=8;
|
||
var two=master.layers.add(city);two.startTime=8;two.inPoint=8;two.outPoint=20;
|
||
var studioAudio=app.project.importFile(new ImportOptions(new File(root+"/assets/audio/startup/studio-ident.wav")));
|
||
var cityAudio=app.project.importFile(new ImportOptions(new File(root+"/assets/audio/startup/casino-title.wav")));
|
||
var a1=master.layers.add(studioAudio);a1.name="Audio / studio";a1.startTime=0;a1.outPoint=8;
|
||
var a2=master.layers.add(cityAudio);a2.name="Audio / city";a2.startTime=8;a2.inPoint=8;a2.outPoint=20;
|
||
// The game and review export use these same two WAV files.
|
||
var rq=app.project.renderQueue.items.add(master);
|
||
rq.render=true;rq.timeSpanStart=0;rq.timeSpanDuration=20;
|
||
rq.setSetting("Resolution","Half");
|
||
var om=rq.outputModule(1);
|
||
var templates=om.templates, png=null;
|
||
for(var q=0;q<templates.length;q++) if(/PNG/i.test(templates[q])) {png=templates[q];break;}
|
||
if(png) om.applyTemplate(png);
|
||
else log("Default output format: "+om.getSetting("Format"));
|
||
om.file=new File(png ? work+"/render/film_[#####].png" : work+"/render/master-v3.mp4");
|
||
app.project.save(new File(root+"/assets/cinematics/source/AssemblerCasino-v3.aep"));
|
||
log("SUCCESS: project saved; output module "+(png||"AE default video module"));
|
||
} catch (e) { log("ERROR: "+e.toString()+" at line "+e.line); try { app.project.close(CloseOptions.DO_NOT_SAVE_CHANGES); } catch (ignored) {} }
|
||
app.endSuppressDialogs(false);
|
||
app.quit();
|
||
})();
|