-
Notifications
You must be signed in to change notification settings - Fork 170
/
Copy pathtext-transition_edgeActions.js
72 lines (56 loc) · 2.93 KB
/
text-transition_edgeActions.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/***********************
* Adobe Edge Animate Composition Actions
*
* Edit this file with caution, being careful to preserve
* function signatures and comments starting with 'Edge' to maintain the
* ability to interact with these actions from within Adobe Edge Animate
*
***********************/
(function($, Edge, compId){
var Composition = Edge.Composition, Symbol = Edge.Symbol; // aliases for commonly used Edge classes
//Edge symbol: 'stage'
(function(symbolName) {
Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 36000, function(sym, e) {
// Play the timeline at a label or specific time. For example:
// sym.play(500); or sym.play("myLabel");
sym.play(0);
});
//Edge binding end
Symbol.bindElementAction(compId, symbolName, "document", "compositionReady", function(sym, e) {
var stageHeight = sym.$('Stage').height(); // Set a variable for the height of the stage
sym.$("#Stage").css({ // Set the transform origin so we always scale to the top left corner of the stage
"transform-origin":"0 0",
"-ms-transform-origin":"0 0",
"-webkit-transform-origin":"0 0",
"-moz-transform-origin":"0 0",
"-o-transform-origin":"0 0"
});
function scaleStage() {
var stage = sym.$('Stage'); // Set a reusable variable to reference the stage
var parent = sym.$('Stage').parent(); // Set a reusable variable to reference the parent container of the stage
var parentWidth = stage.parent().width(); // Get the parent of the stage width
var stageWidth = stage.width(); // Get the stage width
var desiredWidth = Math.round(parentWidth * 1); // Set the new width of the stage as it scales
var rescale = (desiredWidth / stageWidth); // Set a variable to calculate the new width of the stage as it scales
// Rescale the stage!
stage.css('transform', 'scale(' + rescale + ')');
stage.css( '-o-transform', 'scale(' + rescale + ')');
stage.css('-ms-transform', 'scale(' + rescale + ')');
stage.css('-webkit-transform', 'scale(' + rescale + ')');
stage.css('-moz-transform', 'scale(' + rescale + ')');
stage.css('-o-transform', 'scale(' + rescale + ')');
parent.height(stageHeight * rescale); // Reset the height of the parent container so the objects below it will reflow as the height adjusts
}
// Make it happen when the browser resizes
$(window).on('resize', function(){
scaleStage();
});
// Make it happen when the page first loads
$(document).ready(function(){
scaleStage();
});
});
//Edge binding end
})("stage");
//Edge symbol end:'stage'
})(jQuery, AdobeEdge, "EDGE-351089231");