initial
This commit is contained in:
@@ -0,0 +1,352 @@
|
||||
(function (cjs, an) {
|
||||
|
||||
var p; // shortcut to reference prototypes
|
||||
var lib={};var ss={};var img={};
|
||||
lib.ssMetadata = [];
|
||||
|
||||
|
||||
(lib.AnMovieClip = function(){
|
||||
this.actionFrames = [];
|
||||
this.ignorePause = false;
|
||||
this.gotoAndPlay = function(positionOrLabel){
|
||||
cjs.MovieClip.prototype.gotoAndPlay.call(this,positionOrLabel);
|
||||
}
|
||||
this.play = function(){
|
||||
cjs.MovieClip.prototype.play.call(this);
|
||||
}
|
||||
this.gotoAndStop = function(positionOrLabel){
|
||||
cjs.MovieClip.prototype.gotoAndStop.call(this,positionOrLabel);
|
||||
}
|
||||
this.stop = function(){
|
||||
cjs.MovieClip.prototype.stop.call(this);
|
||||
}
|
||||
}).prototype = p = new cjs.MovieClip();
|
||||
// symbols:
|
||||
// helper functions:
|
||||
|
||||
function mc_symbol_clone() {
|
||||
var clone = this._cloneProps(new this.constructor(this.mode, this.startPosition, this.loop, this.reversed));
|
||||
clone.gotoAndStop(this.currentFrame);
|
||||
clone.paused = this.paused;
|
||||
clone.framerate = this.framerate;
|
||||
return clone;
|
||||
}
|
||||
|
||||
function getMCSymbolPrototype(symbol, nominalBounds, frameBounds) {
|
||||
var prototype = cjs.extend(symbol, cjs.MovieClip);
|
||||
prototype.clone = mc_symbol_clone;
|
||||
prototype.nominalBounds = nominalBounds;
|
||||
prototype.frameBounds = frameBounds;
|
||||
return prototype;
|
||||
}
|
||||
|
||||
|
||||
(lib.unit = function(mode,startPosition,loop,reversed) {
|
||||
if (loop == null) { loop = false; }
|
||||
if (reversed == null) { reversed = false; }
|
||||
var props = new Object();
|
||||
props.mode = mode;
|
||||
props.startPosition = startPosition;
|
||||
props.labels = {};
|
||||
props.loop = loop;
|
||||
props.reversed = reversed;
|
||||
cjs.MovieClip.apply(this,[props]);
|
||||
|
||||
this.isSingleFrame = false;
|
||||
// timeline functions:
|
||||
this.frame_0 = function() {
|
||||
if(this.isSingleFrame) {
|
||||
return;
|
||||
}
|
||||
if(this.totalFrames == 1) {
|
||||
this.isSingleFrame = true;
|
||||
}
|
||||
var data = SMARTGfxLink.data || {};
|
||||
|
||||
this.unitStyle.maxWidth = 1800;
|
||||
this.unitStyle.lineWidth = null;
|
||||
|
||||
this.unitStyle.text = data.unitText;
|
||||
}
|
||||
|
||||
// actions tween:
|
||||
this.timeline.addTween(cjs.Tween.get(this).call(this.frame_0).wait(1));
|
||||
|
||||
// Layer_1
|
||||
this.text = new cjs.Text("", "80px 'CodecPro-Bold'", "#2AB41F");
|
||||
this.text.textAlign = "center";
|
||||
this.text.lineHeight = 101;
|
||||
this.text.lineWidth = 100;
|
||||
this.text.parent = this;
|
||||
this.text.setTransform(-1033.65,739.25);
|
||||
|
||||
this.unitStyle = new cjs.Text("km/h", "bold 50px 'Consolas'", "#FFFFFF");
|
||||
this.unitStyle.name = "unitStyle";
|
||||
this.unitStyle.textAlign = "center";
|
||||
this.unitStyle.lineHeight = 61;
|
||||
this.unitStyle.lineWidth = 280;
|
||||
this.unitStyle.parent = this;
|
||||
this.unitStyle.setTransform(-0.05,-135.9);
|
||||
|
||||
this.timeline.addTween(cjs.Tween.get({}).to({state:[{t:this.unitStyle},{t:this.text}]}).wait(1));
|
||||
|
||||
this._renderFirstFrame();
|
||||
|
||||
}).prototype = getMCSymbolPrototype(lib.unit, new cjs.Rectangle(-1085.6,-137.9,1227.5,977.8), null);
|
||||
|
||||
|
||||
(lib.speed_clip = function(mode,startPosition,loop,reversed) {
|
||||
if (loop == null) { loop = false; }
|
||||
if (reversed == null) { reversed = false; }
|
||||
var props = new Object();
|
||||
props.mode = mode;
|
||||
props.startPosition = startPosition;
|
||||
props.labels = {};
|
||||
props.loop = loop;
|
||||
props.reversed = reversed;
|
||||
cjs.MovieClip.apply(this,[props]);
|
||||
|
||||
// timeline functions:
|
||||
this.frame_0 = function() {
|
||||
var data = SMARTGfxLink.data || {};
|
||||
|
||||
var unit = data.unitType;
|
||||
|
||||
//var animationLength = 42;
|
||||
//var startFrame = this.currentFrame;
|
||||
|
||||
if (unit == "KPH") {
|
||||
|
||||
var serveSpeed = data.serveSpeed;
|
||||
|
||||
this.speed.text = parseFloat(serveSpeed).toFixed(0) || "";
|
||||
|
||||
/*const countUpAnimation = () => {
|
||||
var frameDifference = this.currentFrame - startFrame;
|
||||
var progress = EasingFunctions.easeOutCubic(frameDifference/animationLength);
|
||||
this.speed.text = Math.max(Math.min( (serveSpeed * (progress) ), serveSpeed), 0).toFixed(0);
|
||||
}
|
||||
|
||||
this.addEventListener('tick', countUpAnimation);*/
|
||||
} else if (unit == "MPH") {
|
||||
|
||||
var serveSpeed = KPHtoMPH(data.serveSpeed);
|
||||
|
||||
this.speed.text = parseFloat(serveSpeed).toFixed(0) || "";
|
||||
|
||||
/*const countUpAnimation = () => {
|
||||
var frameDifference = this.currentFrame - startFrame;
|
||||
var progress = EasingFunctions.easeOutCubic(frameDifference/animationLength);
|
||||
this.speed.text = Math.max(Math.min( (serveSpeed * (progress) ), serveSpeed), 0).toFixed(0);
|
||||
}
|
||||
|
||||
this.addEventListener('tick', countUpAnimation);*/
|
||||
}
|
||||
}
|
||||
this.frame_1 = function() {
|
||||
this.gotoAndPlay(0);
|
||||
}
|
||||
|
||||
// actions tween:
|
||||
this.timeline.addTween(cjs.Tween.get(this).call(this.frame_0).wait(1).call(this.frame_1).wait(1));
|
||||
|
||||
// Layer 1
|
||||
this.speed = new cjs.Text("134", "bold 75px 'Consolas'", "#FFFFFF");
|
||||
this.speed.name = "speed";
|
||||
this.speed.textAlign = "center";
|
||||
this.speed.lineHeight = 90;
|
||||
this.speed.lineWidth = 354;
|
||||
this.speed.parent = this;
|
||||
this.speed.setTransform(-74.6,-100.35);
|
||||
|
||||
this.timeline.addTween(cjs.Tween.get(this.speed).wait(1).to({x:178,y:-138.65,font:"bold 200px 'Sharp Sans Display No1'",textAlign:NaN,lineHeight:265},0).wait(1));
|
||||
|
||||
this._renderFirstFrame();
|
||||
|
||||
}).prototype = p = new cjs.MovieClip();
|
||||
p.nominalBounds = new cjs.Rectangle(-253.5,-140.6,433.5,305.29999999999995);
|
||||
|
||||
|
||||
// stage content:
|
||||
(lib.speedboard = function(mode,startPosition,loop,reversed) {
|
||||
if (loop == null) { loop = true; }
|
||||
if (reversed == null) { reversed = false; }
|
||||
var props = new Object();
|
||||
props.mode = mode;
|
||||
props.startPosition = startPosition;
|
||||
props.labels = {};
|
||||
props.loop = loop;
|
||||
props.reversed = reversed;
|
||||
cjs.MovieClip.apply(this,[props]);
|
||||
|
||||
this.actionFrames = [5,13];
|
||||
// timeline functions:
|
||||
this.frame_5 = function() {
|
||||
this.stop();
|
||||
SMARTGfxLink.incrementKeyframe();
|
||||
}
|
||||
this.frame_13 = function() {
|
||||
SMARTGfxLink.reset();
|
||||
}
|
||||
|
||||
// actions tween:
|
||||
this.timeline.addTween(cjs.Tween.get(this).wait(5).call(this.frame_5).wait(8).call(this.frame_13).wait(2));
|
||||
|
||||
// speed
|
||||
this.speedClip = new lib.speed_clip();
|
||||
this.speedClip.name = "speedClip";
|
||||
this.speedClip.setTransform(882.25,1254.25,0.9387,0.9385,0,0,0,703.5,382.9);
|
||||
this.speedClip._off = true;
|
||||
|
||||
this.timeline.addTween(cjs.Tween.get(this.speedClip).wait(1).to({_off:false},0).to({_off:true},12).wait(2));
|
||||
|
||||
// unit
|
||||
this.unitClip = new lib.unit();
|
||||
this.unitClip.name = "unitClip";
|
||||
this.unitClip.setTransform(1170.65,1446.4,1.2363,1.2336,0,0,0,703.5,382.7);
|
||||
this.unitClip._off = true;
|
||||
|
||||
this.timeline.addTween(cjs.Tween.get(this.unitClip).wait(1).to({_off:false},0).to({_off:true},12).wait(2));
|
||||
|
||||
// Layer_1
|
||||
this.text = new cjs.Text("", "50px 'Consolas-Bold'", "#FFFFFF");
|
||||
this.text.textAlign = "center";
|
||||
this.text.lineHeight = 61;
|
||||
this.text.lineWidth = 100;
|
||||
this.text.parent = this;
|
||||
this.text.setTransform(240.2,1227.05);
|
||||
|
||||
this.timeline.addTween(cjs.Tween.get(this.text).wait(15));
|
||||
|
||||
this._renderFirstFrame();
|
||||
|
||||
}).prototype = p = new lib.AnMovieClip();
|
||||
p.nominalBounds = new cjs.Rectangle(-81.3,1338.9,557.6999999999999,671.5);
|
||||
// library properties:
|
||||
lib.properties = {
|
||||
id: '36D6E8BDDCB50B4D9681420AF6CA779E',
|
||||
width: 1920,
|
||||
height: 1080,
|
||||
fps: 50,
|
||||
color: "#323232",
|
||||
opacity: 0.00,
|
||||
manifest: [],
|
||||
preloads: []
|
||||
};
|
||||
|
||||
|
||||
|
||||
// bootstrap callback support:
|
||||
|
||||
(lib.Stage = function(canvas) {
|
||||
createjs.Stage.call(this, canvas);
|
||||
}).prototype = p = new createjs.Stage();
|
||||
|
||||
p.setAutoPlay = function(autoPlay) {
|
||||
this.tickEnabled = autoPlay;
|
||||
}
|
||||
p.play = function() { this.tickEnabled = true; this.getChildAt(0).gotoAndPlay(this.getTimelinePosition()) }
|
||||
p.stop = function(ms) { if(ms) this.seek(ms); this.tickEnabled = false; }
|
||||
p.seek = function(ms) { this.tickEnabled = true; this.getChildAt(0).gotoAndStop(lib.properties.fps * ms / 1000); }
|
||||
p.getDuration = function() { return this.getChildAt(0).totalFrames / lib.properties.fps * 1000; }
|
||||
|
||||
p.getTimelinePosition = function() { return this.getChildAt(0).currentFrame / lib.properties.fps * 1000; }
|
||||
|
||||
an.bootcompsLoaded = an.bootcompsLoaded || [];
|
||||
if(!an.bootstrapListeners) {
|
||||
an.bootstrapListeners=[];
|
||||
}
|
||||
|
||||
an.bootstrapCallback=function(fnCallback) {
|
||||
an.bootstrapListeners.push(fnCallback);
|
||||
if(an.bootcompsLoaded.length > 0) {
|
||||
for(var i=0; i<an.bootcompsLoaded.length; ++i) {
|
||||
fnCallback(an.bootcompsLoaded[i]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
an.compositions = an.compositions || {};
|
||||
an.compositions['36D6E8BDDCB50B4D9681420AF6CA779E'] = {
|
||||
getStage: function() { return exportRoot.stage; },
|
||||
getLibrary: function() { return lib; },
|
||||
getSpriteSheet: function() { return ss; },
|
||||
getImages: function() { return img; }
|
||||
};
|
||||
|
||||
an.compositionLoaded = function(id) {
|
||||
an.bootcompsLoaded.push(id);
|
||||
for(var j=0; j<an.bootstrapListeners.length; j++) {
|
||||
an.bootstrapListeners[j](id);
|
||||
}
|
||||
}
|
||||
|
||||
an.getComposition = function(id) {
|
||||
return an.compositions[id];
|
||||
}
|
||||
|
||||
|
||||
an.makeResponsive = function(isResp, respDim, isScale, scaleType, domContainers) {
|
||||
var lastW, lastH, lastS=1;
|
||||
window.addEventListener('resize', resizeCanvas);
|
||||
resizeCanvas();
|
||||
function resizeCanvas() {
|
||||
var w = lib.properties.width, h = lib.properties.height;
|
||||
var iw = window.innerWidth, ih=window.innerHeight;
|
||||
var pRatio = window.devicePixelRatio || 1, xRatio=iw/w, yRatio=ih/h, sRatio=1;
|
||||
if(isResp) {
|
||||
if((respDim=='width'&&lastW==iw) || (respDim=='height'&&lastH==ih)) {
|
||||
sRatio = lastS;
|
||||
}
|
||||
else if(!isScale) {
|
||||
if(iw<w || ih<h)
|
||||
sRatio = Math.min(xRatio, yRatio);
|
||||
}
|
||||
else if(scaleType==1) {
|
||||
sRatio = Math.min(xRatio, yRatio);
|
||||
}
|
||||
else if(scaleType==2) {
|
||||
sRatio = Math.max(xRatio, yRatio);
|
||||
}
|
||||
}
|
||||
domContainers[0].width = w * pRatio * sRatio;
|
||||
domContainers[0].height = h * pRatio * sRatio;
|
||||
domContainers.forEach(function(container) {
|
||||
container.style.width = w * sRatio + 'px';
|
||||
container.style.height = h * sRatio + 'px';
|
||||
});
|
||||
stage.scaleX = pRatio*sRatio;
|
||||
stage.scaleY = pRatio*sRatio;
|
||||
lastW = iw; lastH = ih; lastS = sRatio;
|
||||
stage.tickOnUpdate = false;
|
||||
stage.update();
|
||||
stage.tickOnUpdate = true;
|
||||
}
|
||||
}
|
||||
an.handleSoundStreamOnTick = function(event) {
|
||||
if(!event.paused){
|
||||
var stageChild = stage.getChildAt(0);
|
||||
if(!stageChild.paused || stageChild.ignorePause){
|
||||
stageChild.syncStreamSounds();
|
||||
}
|
||||
}
|
||||
}
|
||||
an.handleFilterCache = function(event) {
|
||||
if(!event.paused){
|
||||
var target = event.target;
|
||||
if(target){
|
||||
if(target.filterCacheList){
|
||||
for(var index = 0; index < target.filterCacheList.length ; index++){
|
||||
var cacheInst = target.filterCacheList[index];
|
||||
if((cacheInst.startFrame <= target.currentFrame) && (target.currentFrame <= cacheInst.endFrame)){
|
||||
cacheInst.instance.cache(cacheInst.x, cacheInst.y, cacheInst.w, cacheInst.h);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
})(createjs = createjs||{}, AdobeAn = AdobeAn||{});
|
||||
var createjs, AdobeAn;
|
||||
Reference in New Issue
Block a user