SHOW:
|
|
- or go back to the newest paste.
1 | <!DOCTYPE html> | |
2 | <!-- | |
3 | NOTES: | |
4 | 1. All tokens are represented by '$' sign in the template. | |
5 | 2. You can write your code only wherever mentioned. | |
6 | 3. All occurrences of existing tokens will be replaced by their appropriate values. | |
7 | 4. Blank lines will be removed automatically. | |
8 | 5. Remove unnecessary comments before creating your template. | |
9 | --> | |
10 | <html> | |
11 | <head> | |
12 | <meta charset="UTF-8"> | |
13 | <meta name="authoring-tool" content="Adobe_Animate_CC"> | |
14 | <Meta name=”ad.size” content=width=300,height”250”> | |
15 | <script type=”text/javascript”> | |
16 | var clicTag = “https://www.google.com”; | |
17 | var clicTag1 = “https://www.doublebygoogle.com”; | |
18 | var clicTag2 = “https://www.google.com/doubleclick/studio”; | |
19 | ||
20 | <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> | |
21 | <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css"> | |
22 | <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script> | |
23 | ||
24 | <script type="text/javascript"> | |
25 | $(document).ready(function() { | |
26 | $("#mikkels-link").click(function(e) { | |
27 | e.preventDefault(); | |
28 | ||
29 | $("#mikkels-vindue").dialog(); | |
30 | }); | |
31 | }); | |
32 | </script> | |
33 | - | #mikkels-vindue { |
33 | + | <!-- Mikkel er en døgenigt --> |
34 | <style type="text/css"> | |
35 | #mikkels-vindue { | |
36 | - | </style> |
36 | + | |
37 | } | |
38 | </style> | |
39 | ||
40 | <title>Stofa Bredbånd</title> | |
41 | <script> | |
42 | $( function() { | |
43 | $( "#dialog" ).dialog(); | |
44 | } ); | |
45 | </script> | |
46 | </script> | |
47 | ||
48 | <title>StofaBredbånd</title> | |
49 | <!-- write your code here --> | |
50 | <script src="https://code.createjs.com/createjs-2015.11.26.min.js"></script> | |
51 | <script src="StofaBredbånd.js"></script> | |
52 | <script> | |
53 | var canvas, stage, exportRoot, anim_container, dom_overlay_container, fnStartAnimation; | |
54 | function init() { | |
55 | canvas = document.getElementById("canvas"); | |
56 | anim_container = document.getElementById("animation_container"); | |
57 | dom_overlay_container = document.getElementById("dom_overlay_container"); | |
58 | var comp=AdobeAn.getComposition("95CE25E0372F467682A854F8B73D5C84"); | |
59 | var lib=comp.getLibrary(); | |
60 | var loader = new createjs.LoadQueue(false); | |
61 | loader.addEventListener("fileload", function(evt){handleFileLoad(evt,comp)}); | |
62 | loader.addEventListener("complete", function(evt){handleComplete(evt,comp)}); | |
63 | var lib=comp.getLibrary(); | |
64 | loader.loadManifest(lib.properties.manifest); | |
65 | } | |
66 | function handleFileLoad(evt, comp) { | |
67 | var images=comp.getImages(); | |
68 | if (evt && (evt.item.type == "image")) { images[evt.item.id] = evt.result; } | |
69 | } | |
70 | function handleComplete(evt,comp) { | |
71 | //This function is always called, irrespective of the content. You can use the variable "stage" after it is created in token create_stage. | |
72 | var lib=comp.getLibrary(); | |
73 | var ss=comp.getSpriteSheet(); | |
74 | var queue = evt.target; | |
75 | var ssMetadata = lib.ssMetadata; | |
76 | for(i=0; i<ssMetadata.length; i++) { | |
77 | ss[ssMetadata[i].name] = new createjs.SpriteSheet( {"images": [queue.getResult(ssMetadata[i].name)], "frames": ssMetadata[i].frames} ) | |
78 | } | |
79 | exportRoot = new lib.Bannerdisplay320x320(); | |
80 | stage = new lib.Stage(canvas); | |
81 | stage.enableMouseOver(); | |
82 | //Registers the "tick" event listener. | |
83 | fnStartAnimation = function() { | |
84 | stage.addChild(exportRoot); | |
85 | createjs.Ticker.setFPS(lib.properties.fps); | |
86 | createjs.Ticker.addEventListener("tick", stage) | |
87 | stage.addEventListener("tick", handleTick) | |
88 | function getProjectionMatrix(container, totalDepth) { | |
89 | var focalLength = 528.25; | |
90 | var projectionCenter = { x : lib.properties.width/2, y : lib.properties.height/2 }; | |
91 | var scale = (totalDepth + focalLength)/focalLength; | |
92 | var scaleMat = new createjs.Matrix2D; | |
93 | scaleMat.a = 1/scale; | |
94 | scaleMat.d = 1/scale; | |
95 | var projMat = new createjs.Matrix2D; | |
96 | projMat.tx = -projectionCenter.x; | |
97 | projMat.ty = -projectionCenter.y; | |
98 | projMat = projMat.prependMatrix(scaleMat); | |
99 | projMat.tx += projectionCenter.x; | |
100 | projMat.ty += projectionCenter.y; | |
101 | return projMat; | |
102 | } | |
103 | function handleTick(event) { | |
104 | var cameraInstance = exportRoot.___camera___instance; | |
105 | if(cameraInstance !== undefined && cameraInstance.pinToObject !== undefined) | |
106 | { | |
107 | cameraInstance.x = cameraInstance.pinToObject.x + cameraInstance.pinToObject.pinOffsetX; | |
108 | cameraInstance.y = cameraInstance.pinToObject.y + cameraInstance.pinToObject.pinOffsetY; | |
109 | if(cameraInstance.pinToObject.parent !== undefined && cameraInstance.pinToObject.parent.depth !== undefined) | |
110 | cameraInstance.depth = cameraInstance.pinToObject.parent.depth + cameraInstance.pinToObject.pinOffsetZ; | |
111 | } | |
112 | applyLayerZDepth(exportRoot); | |
113 | } | |
114 | function applyLayerZDepth(parent) | |
115 | { | |
116 | var cameraInstance = parent.___camera___instance; | |
117 | var focalLength = 528.25; | |
118 | var projectionCenter = { 'x' : 0, 'y' : 0}; | |
119 | if(parent === exportRoot) | |
120 | { | |
121 | var stageCenter = { 'x' : lib.properties.width/2, 'y' : lib.properties.height/2 }; | |
122 | projectionCenter.x = stageCenter.x; | |
123 | projectionCenter.y = stageCenter.y; | |
124 | } | |
125 | for(child in parent.children) | |
126 | { | |
127 | var layerObj = parent.children[child]; | |
128 | if(layerObj == cameraInstance) | |
129 | continue; | |
130 | applyLayerZDepth(layerObj, cameraInstance); | |
131 | if(layerObj.layerDepth === undefined) | |
132 | continue; | |
133 | if(layerObj.currentFrame != layerObj.parent.currentFrame) | |
134 | { | |
135 | layerObj.gotoAndPlay(layerObj.parent.currentFrame); | |
136 | } | |
137 | var matToApply = new createjs.Matrix2D; | |
138 | var cameraMat = new createjs.Matrix2D; | |
139 | var totalDepth = layerObj.layerDepth ? layerObj.layerDepth : 0; | |
140 | var cameraDepth = 0; | |
141 | if(cameraInstance && !layerObj.isAttachedToCamera) | |
142 | { | |
143 | var mat = cameraInstance.getMatrix(); | |
144 | mat.tx -= projectionCenter.x; | |
145 | mat.ty -= projectionCenter.y; | |
146 | cameraMat = mat.invert(); | |
147 | cameraMat.prependTransform(projectionCenter.x, projectionCenter.y, 1, 1, 0, 0, 0, 0, 0); | |
148 | cameraMat.appendTransform(-projectionCenter.x, -projectionCenter.y, 1, 1, 0, 0, 0, 0, 0); | |
149 | if(cameraInstance.depth) | |
150 | cameraDepth = cameraInstance.depth; | |
151 | } | |
152 | if(layerObj.depth) | |
153 | { | |
154 | totalDepth = layerObj.depth; | |
155 | } | |
156 | //Offset by camera depth | |
157 | totalDepth -= cameraDepth; | |
158 | if(totalDepth < -focalLength) | |
159 | { | |
160 | matToApply.a = 0; | |
161 | matToApply.d = 0; | |
162 | } | |
163 | else | |
164 | { | |
165 | if(layerObj.layerDepth) | |
166 | { | |
167 | var sizeLockedMat = getProjectionMatrix(parent, layerObj.layerDepth); | |
168 | if(sizeLockedMat) | |
169 | { | |
170 | sizeLockedMat.invert(); | |
171 | matToApply.prependMatrix(sizeLockedMat); | |
172 | } | |
173 | } | |
174 | matToApply.prependMatrix(cameraMat); | |
175 | var projMat = getProjectionMatrix(parent, totalDepth); | |
176 | if(projMat) | |
177 | { | |
178 | matToApply.prependMatrix(projMat); | |
179 | } | |
180 | } | |
181 | layerObj.transformMatrix = matToApply; | |
182 | } | |
183 | } | |
184 | } | |
185 | //Code to support hidpi screens and responsive scaling. | |
186 | function makeResponsive(isResp, respDim, isScale, scaleType) { | |
187 | var lastW, lastH, lastS=1; | |
188 | window.addEventListener('resize', resizeCanvas); | |
189 | resizeCanvas(); | |
190 | function resizeCanvas() { | |
191 | var w = lib.properties.width, h = lib.properties.height; | |
192 | var iw = window.innerWidth, ih=window.innerHeight; | |
193 | var pRatio = window.devicePixelRatio || 1, xRatio=iw/w, yRatio=ih/h, sRatio=1; | |
194 | if(isResp) { | |
195 | if((respDim=='width'&&lastW==iw) || (respDim=='height'&&lastH==ih)) { | |
196 | sRatio = lastS; | |
197 | } | |
198 | else if(!isScale) { | |
199 | if(iw<w || ih<h) | |
200 | sRatio = Math.min(xRatio, yRatio); | |
201 | } | |
202 | else if(scaleType==1) { | |
203 | sRatio = Math.min(xRatio, yRatio); | |
204 | } | |
205 | else if(scaleType==2) { | |
206 | sRatio = Math.max(xRatio, yRatio); | |
207 | } | |
208 | } | |
209 | canvas.width = w*pRatio*sRatio; | |
210 | canvas.height = h*pRatio*sRatio; | |
211 | canvas.style.width = dom_overlay_container.style.width = anim_container.style.width = w*sRatio+'px'; | |
212 | canvas.style.height = anim_container.style.height = dom_overlay_container.style.height = h*sRatio+'px'; | |
213 | stage.scaleX = pRatio*sRatio; | |
214 | stage.scaleY = pRatio*sRatio; | |
215 | lastW = iw; lastH = ih; lastS = sRatio; | |
216 | stage.tickOnUpdate = false; | |
217 | stage.update(); | |
218 | stage.tickOnUpdate = true; | |
219 | } | |
220 | } | |
221 | makeResponsive(false,'both',false,1); | |
222 | AdobeAn.compositionLoaded(lib.properties.id); | |
223 | fnStartAnimation(); | |
224 | } | |
225 | </script> | |
226 | <a href=”javascript:window:open(windowclicktag)”> | |
227 | </a> | |
228 | <a href=”javascript:window:open(windowclicktag)1”> | |
229 | </a> | |
230 | <a href=”javascript:window:open(windowclicktag2)”> | |
231 | </a> | |
232 | ||
233 | <!-- write your code here --> | |
234 | </head> | |
235 | <body onload="init();" style="margin:0px;"> | |
236 | <div id="animation_container" style="background-color:rgba(255, 255, 255, 1.00); width:320px; height:320px"> | |
237 | <canvas id="canvas" width="320" height="320" style="position: absolute; display: block; background-color:rgba(255, 255, 255, 1.00);"></canvas> | |
238 | <div id="dom_overlay_container" style="pointer-events:none; overflow:hidden; width:320px; height:320px; position: absolute; left: 0px; top: 0px; display: block;"> | |
239 | </div> | |
240 | </div> | |
241 | <a id="mikkels-link" href="#">Betingelser</a> | |
242 | <div id="mikkels-vindue" title="Betingelser"> | |
243 | <p>Ja hej</p> | |
244 | </div> | |
245 | </body> | |
246 | </html> |