-
Notifications
You must be signed in to change notification settings - Fork 0
/
01-using-components.html
81 lines (68 loc) · 2.87 KB
/
01-using-components.html
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
73
74
75
76
77
78
79
80
81
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>ZIM Frame - Full Template</title>
<!-- Welcome to ZIM at http://zimjs.com - Code Interactive Media Pizzazz! -->
<!-- ZIM runs on the HTML Canvas powered by JavaScript and CreateJS http://createjs.com -->
<!-- Founded by Inventor Dan Zen - http://danzen.com - Canadian New Media Award Winner -->
<!-- ZIM is free to use. You can donate to help improve ZIM at http://zimjs.com/donate -->
<!-- as of ZIM 4.3.0 load createjs namespace first -->
<script src="https://code.createjs.com/createjs-2015.11.26.min.js"></script>
<script>var zon = true; // true for comments from zim code</script>
<script src="https://d309knd7es5f10.cloudfront.net/zim_4.7.3.js"></script><!-- add _doc to see code -->
<!-- use zimjs.com/code/distill for minified individual functions! -->
<script>
// SCALING OPTIONS
// scaling can have values as follows with full being the default
// "fit" sets canvas and stage to dimensions and scales to fit inside window size
// "outside" sets canvas and stage to dimensions and scales to fit outside window size
// "full" sets stage to window size with no scaling
// "tagID" add canvas to HTML tag of ID - set to dimensions if provided - no scaling
var scaling = "full"; // makes stage the window size but does not scale content
var width = null;
var height = null;
var color = "#ebcb35";
var frame = new zim.Frame(scaling, width, height, color); // see docs for more options and info
frame.on("ready", function() {
zog("ready from ZIM Frame");
var stage = frame.stage;
var stageW = frame.width;
var stageH = frame.height;
// put your code here (you can delete this code)
// CREATE COMPONENT
// var component = new zim.Button();
// var component = new zim.CheckBox();
// var component = new zim.RadioButtons();
// var component = new zim.Pane();
// var component = new zim.Window();
var component = new zim.Waiter(stage);
// var component = new zim.Indicator();
// var component = new zim.Stepper();
// var component = new zim.Slider();
// var component = new zim.Dial();
// var component = new zim.Tabs();
// var component = new zim.Pad();
// var component = new zim.ColorPicker();
// component.center(stage);
component.show();
// UPDATE STAGE TO APPLY CHANGES
stage.update()
// put resizing code in here
// resize also gets called initially
// frame.on("resize", resize);
// function resize(e) {
// stageW = frame.width;
// stageH = frame.height;
// // can redraw things at different sizes or use scaling here
// // rect.scaleTo(stage, 20); // also see zim.Layout() for more complex scaling
// rect.center(stage); // this adds to stage as well otherwise stage.addChild(button);
// stage.update();
// }
}); // end of ready
</script>
</head>
<body>
<!-- canvas with id="myCanvas" is made by zim Frame -->
</body>
</html>