Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.00 KB | None | 0 0
  1. (function (cjs, an) {
  2.  
  3. var p; // shortcut to reference prototypes
  4. var lib={};var ss={};var img={};
  5. lib.ssMetadata = [
  6. {name:"sample_atlas_", frames: [[0,0,492,458]]}
  7. ];
  8.  
  9.  
  10. // symbols:
  11.  
  12.  
  13.  
  14. (lib.charcter = function() {
  15. this.initialize(ss["sample_atlas_"]);
  16. this.gotoAndStop(0);
  17. }).prototype = p = new cjs.Sprite();
  18. // helper functions:
  19.  
  20. function mc_symbol_clone() {
  21. var clone = this._cloneProps(new this.constructor(this.mode, this.startPosition, this.loop));
  22. clone.gotoAndStop(this.currentFrame);
  23. clone.paused = this.paused;
  24. clone.framerate = this.framerate;
  25. return clone;
  26. }
  27.  
  28. function getMCSymbolPrototype(symbol, nominalBounds, frameBounds) {
  29. var prototype = cjs.extend(symbol, cjs.MovieClip);
  30. prototype.clone = mc_symbol_clone;
  31. prototype.nominalBounds = nominalBounds;
  32. prototype.frameBounds = frameBounds;
  33. return prototype;
  34. }
  35.  
  36.  
  37. (lib.charcter_レイヤー_1 = function(mode,startPosition,loop) {
  38. this.initialize(mode,startPosition,loop,{});
  39.  
  40. // レイヤー_1
  41. this.instance = new lib.charcter();
  42. this.instance.parent = this;
  43. this.instance.setTransform(-246,-229);
  44.  
  45. this.timeline.addTween(cjs.Tween.get(this.instance).wait(1));
  46.  
  47. }).prototype = getMCSymbolPrototype(lib.charcter_レイヤー_1, null, null);
  48.  
  49.  
  50. (lib.charcter_1 = function(mode,startPosition,loop) {
  51. this.initialize(mode,startPosition,loop,{});
  52.  
  53. // レイヤー_1_obj_
  54. this.レイヤー_1 = new lib.charcter_レイヤー_1();
  55. this.レイヤー_1.name = "レイヤー_1";
  56. this.レイヤー_1.parent = this;
  57. this.レイヤー_1.depth = 0;
  58. this.レイヤー_1.isAttachedToCamera = 0
  59. this.レイヤー_1.isAttachedToMask = 0
  60. this.レイヤー_1.layerDepth = 0
  61. this.レイヤー_1.layerIndex = 0
  62. this.レイヤー_1.maskLayerName = 0
  63.  
  64. this.timeline.addTween(cjs.Tween.get(this.レイヤー_1).wait(1));
  65.  
  66. }).prototype = getMCSymbolPrototype(lib.charcter_1, new cjs.Rectangle(-246,-229,492,458), null);
  67.  
  68.  
  69. (lib.シーン_1_charcter = function(mode,startPosition,loop) {
  70. this.initialize(mode,startPosition,loop,{});
  71.  
  72. // charcter
  73. this.mc_charcter = new lib.charcter_1();
  74. this.mc_charcter.name = "mc_charcter";
  75. this.mc_charcter.parent = this;
  76. this.mc_charcter.setTransform(512,384);
  77.  
  78. this.timeline.addTween(cjs.Tween.get(this.mc_charcter).wait(1));
  79.  
  80. }).prototype = getMCSymbolPrototype(lib.シーン_1_charcter, null, null);
  81.  
  82.  
  83. // stage content:
  84. (lib.sample = function(mode,startPosition,loop) {
  85. this.initialize(mode,startPosition,loop,{});
  86.  
  87. this.___GetDepth___ = function(obj) {
  88. var depth = obj.depth;
  89. var cameraObj = this.___camera___instance;
  90. if(cameraObj && cameraObj.depth && obj.isAttachedToCamera)
  91. {
  92. depth += depth + cameraObj.depth;
  93. }
  94. return depth;
  95. }
  96. this.___needSorting___ = function() {
  97. for (var i = 0; i < this.getNumChildren() - 1; i++)
  98. {
  99. var prevDepth = this.___GetDepth___(this.getChildAt(i));
  100. var nextDepth = this.___GetDepth___(this.getChildAt(i + 1));
  101. if (prevDepth < nextDepth)
  102. return true;
  103. }
  104. return false;
  105. }
  106. this.___sortFunction___ = function(obj1, obj2) {
  107. return (this.exportRoot.___GetDepth___(obj2) - this.exportRoot.___GetDepth___(obj1));
  108. }
  109. this.on('tick', function (event){
  110. var curTimeline = event.currentTarget;
  111. if (curTimeline.___needSorting___()){
  112. this.sortChildren(curTimeline.___sortFunction___);
  113. }
  114. });
  115.  
  116. // timeline functions:
  117. this.frame_0 = function() {
  118. this.mc_charcter = this.charcter.mc_charcter;
  119. }
  120.  
  121. // actions tween:
  122. this.timeline.addTween(cjs.Tween.get(this).call(this.frame_0).wait(1));
  123.  
  124. // charcter_obj_
  125. this.charcter = new lib.シーン_1_charcter();
  126. this.charcter.name = "charcter";
  127. this.charcter.parent = this;
  128. this.charcter.setTransform(512,384,1,1,0,0,0,512,384);
  129. this.charcter.depth = 0;
  130. this.charcter.isAttachedToCamera = 0
  131. this.charcter.isAttachedToMask = 0
  132. this.charcter.layerDepth = 0
  133. this.charcter.layerIndex = 0
  134. this.charcter.maskLayerName = 0
  135.  
  136. this.timeline.addTween(cjs.Tween.get(this.charcter).wait(1));
  137.  
  138. }).prototype = p = new cjs.MovieClip();
  139. p.nominalBounds = new cjs.Rectangle(778,539,-20,74);
  140. // library properties:
  141. lib.properties = {
  142. id: '7249A8F452092C418E560C9BF70C0C94',
  143. width: 1024,
  144. height: 768,
  145. fps: 30,
  146. color: "#FFFFFF",
  147. opacity: 1.00,
  148. manifest: [
  149. {src:"images/sample_atlas_.png", id:"sample_atlas_"}
  150. ],
  151. preloads: []
  152. };
  153.  
  154.  
  155.  
  156. // bootstrap callback support:
  157.  
  158. (lib.Stage = function(canvas) {
  159. createjs.Stage.call(this, canvas);
  160. }).prototype = p = new createjs.Stage();
  161.  
  162. p.setAutoPlay = function(autoPlay) {
  163. this.tickEnabled = autoPlay;
  164. }
  165. p.play = function() { this.tickEnabled = true; this.getChildAt(0).gotoAndPlay(this.getTimelinePosition()) }
  166. p.stop = function(ms) { if(ms) this.seek(ms); this.tickEnabled = false; }
  167. p.seek = function(ms) { this.tickEnabled = true; this.getChildAt(0).gotoAndStop(lib.properties.fps * ms / 1000); }
  168. p.getDuration = function() { return this.getChildAt(0).totalFrames / lib.properties.fps * 1000; }
  169.  
  170. p.getTimelinePosition = function() { return this.getChildAt(0).currentFrame / lib.properties.fps * 1000; }
  171.  
  172. an.bootcompsLoaded = an.bootcompsLoaded || [];
  173. if(!an.bootstrapListeners) {
  174. an.bootstrapListeners=[];
  175. }
  176.  
  177. an.bootstrapCallback=function(fnCallback) {
  178. an.bootstrapListeners.push(fnCallback);
  179. if(an.bootcompsLoaded.length > 0) {
  180. for(var i=0; i<an.bootcompsLoaded.length; ++i) {
  181. fnCallback(an.bootcompsLoaded[i]);
  182. }
  183. }
  184. };
  185.  
  186. an.compositions = an.compositions || {};
  187. an.compositions['7249A8F452092C418E560C9BF70C0C94'] = {
  188. getStage: function() { return exportRoot.getStage(); },
  189. getLibrary: function() { return lib; },
  190. getSpriteSheet: function() { return ss; },
  191. getImages: function() { return img; }
  192. };
  193.  
  194. an.compositionLoaded = function(id) {
  195. an.bootcompsLoaded.push(id);
  196. for(var j=0; j<an.bootstrapListeners.length; j++) {
  197. an.bootstrapListeners[j](id);
  198. }
  199. }
  200.  
  201. an.getComposition = function(id) {
  202. return an.compositions[id];
  203. }
  204.  
  205.  
  206. // Layer depth API :
  207.  
  208. AdobeAn.Layer = new function() {
  209. this.getLayerZDepth = function(timeline, layerName)
  210. {
  211. if(layerName === "Camera")
  212. layerName = "___camera___instance";
  213. var script = "if(timeline." + layerName + ") timeline." + layerName + ".depth; else 0;";
  214. return eval(script);
  215. }
  216. this.setLayerZDepth = function(timeline, layerName, zDepth)
  217. {
  218. const MAX_zDepth = 10000;
  219. const MIN_zDepth = -5000;
  220. if(zDepth > MAX_zDepth)
  221. zDepth = MAX_zDepth;
  222. else if(zDepth < MIN_zDepth)
  223. zDepth = MIN_zDepth;
  224. if(layerName === "Camera")
  225. layerName = "___camera___instance";
  226. var script = "if(timeline." + layerName + ") timeline." + layerName + ".depth = " + zDepth + ";";
  227. eval(script);
  228. }
  229. this.removeLayer = function(timeline, layerName)
  230. {
  231. if(layerName === "Camera")
  232. layerName = "___camera___instance";
  233. var script = "if(timeline." + layerName + ") timeline.removeChild(timeline." + layerName + ");";
  234. eval(script);
  235. }
  236. this.addNewLayer = function(timeline, layerName, zDepth)
  237. {
  238. if(layerName === "Camera")
  239. layerName = "___camera___instance";
  240. zDepth = typeof zDepth !== 'undefined' ? zDepth : 0;
  241. var layer = new createjs.MovieClip();
  242. layer.name = layerName;
  243. layer.depth = zDepth;
  244. layer.layerIndex = 0;
  245. timeline.addChild(layer);
  246. }
  247. }
  248.  
  249.  
  250. })(createjs = createjs||{}, AdobeAn = AdobeAn||{});
  251. var createjs, AdobeAn;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement