Skip to content

Commit e558266

Browse files
committed
version 1.7
1 parent 9a922e7 commit e558266

17 files changed

Lines changed: 258 additions & 235 deletions

.DS_Store

-2 KB
Binary file not shown.

ex1.htm

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,12 @@
4444
<body>
4545

4646
<div id="code-example" style="display:none">
47-
// VARIABLES
48-
49-
var btnBlue
5047

51-
// SPECIAL FUNCTIONS
52-
5348
// First running function.
5449
var start = function() {
5550

5651
// BUTTON: First Button. Parameters: (left, top, width, height)
57-
btnBlue = createButton(40, 40, 180, 50)
52+
page.btnBlue = createButton(40, 40, 180, 50)
5853
that.text = "HELLO"
5954
that.minimal = 1
6055
//that.round = 14
@@ -66,18 +61,14 @@
6661
//that.width = "auto"
6762
//that.spaceX = 20
6863
//that.color = "orangered"
69-
7064
that.onClick(printHelloWorld)
71-
65+
7266
}
73-
74-
// OTHER FUNCTIONS
75-
67+
7668
var printHelloWorld = function() {
77-
7869
print("Hello World")
79-
8070
}
71+
8172
</div>
8273

8374
</body>

ex10.htm

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,12 @@
5252

5353
var plantList = [];
5454

55-
var boxItems
56-
5755
var start = function() {
5856

5957
page.color = "whitesmoke"
6058

6159
// BOX: Fruit items container box.
62-
boxItems = createBox(40, 40, 300, 230)
60+
page.boxItems = createBox(40, 40, 300, 230)
6361
that.color = "white"
6462
that.round = 13
6563
that.scrollY = 1
@@ -69,7 +67,7 @@
6967

7068
// PLANTITEM: Every item.
7169
createPlantItem(plantDataList[i].name, plantDataList[i].description, plantDataList[i].filePath)
72-
boxItems.add(that)
70+
page.boxItems.add(that)
7371

7472
plantList.push(that)
7573

@@ -78,22 +76,20 @@
7876
page.onResize(pageResized)
7977

8078
}
81-
79+
8280
var pageResized = function() {
83-
84-
boxItems.center()
85-
81+
page.boxItems.center()
8682
}
87-
83+
8884
var createPlantItem = function(titleText, descriptionText, iconFullPath) {
8985

90-
var ITEM_WIDTH = 300
86+
const ITEM_WIDTH = 300
9187

9288
// BOX: Object container box
93-
var box = createBox(0, 0, ITEM_WIDTH, 94)
94-
that.color = "transparent"
95-
// Disable coordinate system.
96-
that.element.style.position = "relative"
89+
const box = createBox()
90+
box.width = ITEM_WIDTH
91+
box.height = 94
92+
box.color = "transparent"
9793

9894
// BOX: Item background box
9995
box.boxBackground = createBox(4, 2, ITEM_WIDTH - 8, 90)
@@ -124,6 +120,9 @@
124120
that.textColor = "gray"
125121
that.fontSize = 14
126122

123+
// Show item as relative:
124+
box.position = "relative"
125+
127126
makeBasicObject(box)
128127
return box
129128

ex2.htm

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,34 +44,27 @@
4444
<body>
4545

4646
<div id="code-example" style="display:none">
47-
// VARIABLES
48-
49-
var lblBottomInfo
50-
51-
// SPECIAL FUNCTIONS
52-
5347
// First running function.
5448
var start = function() {
5549

56-
// LABEL: Bottom Info. Parameters: (left, top, width, height)
57-
lblBottomInfo = createLabel(0, 0, page.width, "auto")
50+
// LABEL: Bottom Info.
51+
page.lblBottomInfo = createLabel()
52+
that.width = page.width
53+
that.height = "auto"
5854
that.text = "This is a label"
59-
that.bottom = 20
6055
that.textAlign = "center"
6156
that.color = "gold"
6257
that.textColor = "rgba(0, 0, 0, 0.4)"
6358
that.spaceY = 10
64-
59+
that.left = 0
60+
that.bottom = 20
61+
6562
page.onResize(pageResized)
6663

6764
}
6865

69-
// OTHER FUNCTIONS
70-
7166
var pageResized = function() {
72-
73-
lblBottomInfo.width = page.width
74-
67+
page.lblBottomInfo.width = page.width
7568
}
7669
</div>
7770

ex3.htm

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,26 +44,22 @@
4444
<body>
4545

4646
<div id="code-example" style="display:none">
47-
// VARIABLES
48-
49-
var imgIcon
50-
51-
// SPECIAL FUNCTIONS
52-
5347
// First running function.
5448
var start = function() {
5549

56-
// IMAGE: Bottom Info. Parameters: (left, top, width, height)
57-
imgIcon = createImage(0, 20, 128, 128)
50+
// IMAGE: Bottom Info.
51+
page.imgIcon = createImage()
52+
that.width = 128
53+
that.height = 128
54+
//that.autoSize = 1
5855
that.load("images/strawberry.png")
59-
that.right = 20
6056
that.space = 15
6157
that.color = "rgba(0, 0, 0, 0.05)"
58+
that.right = 20
59+
that.top = 20
6260
that.onLoad(printImageSizes)
6361

6462
}
65-
66-
// OTHER FUNCTIONS
6763

6864
var printImageSizes = function(self) {
6965

ex4.htm

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,30 +44,20 @@
4444
<body>
4545

4646
<div id="code-example" style="display:none">
47-
// VARIABLES
48-
49-
var txtName
50-
51-
// SPECIAL FUNCTIONS
52-
5347
// First running function.
5448
var start = function() {
5549

5650
// TEXTBOX: Your name. Parameters: (left, top)
57-
txtName = createTextBox(30, 50)
51+
page.txtName = createTextBox(30, 50)
5852
that.title = "Your name:"
5953
that.minimal = 1
6054
that.color = "whitesmoke"
6155
that.onChange(printName)
6256

6357
}
6458

65-
// OTHER FUNCTIONS
66-
6759
var printName = function(self) {
68-
6960
print("Name: " + self.text)
70-
7161
}
7262
</div>
7363

ex5.htm

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,11 @@
4444
<body>
4545

4646
<div id="code-example" style="display:none">
47-
// VARIABLES
48-
49-
var box
50-
51-
// SPECIAL FUNCTIONS
52-
5347
// First running function.
5448
var start = function() {
5549

5650
// BOX: My box.
57-
box = createBox()
51+
page.box = createBox()
5852
that.right = 20
5953
that.bottom = 20
6054
that.width = 120
@@ -65,8 +59,6 @@
6559

6660
}
6761

68-
// OTHER FUNCTIONS
69-
7062
var extendBox = function(self) {
7163

7264
self.width += 20

ex6.htm

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,11 @@
4444
<body>
4545

4646
<div id="code-example" style="display:none">
47-
// Box object name.
48-
var box
49-
47+
// First running function.
5048
var start = function() {
5149

5250
// BOX: Orangered box.
53-
box = createBox()
51+
page.box = createBox()
5452
that.width = 120
5553
that.height = 120
5654
that.color = "orangered"

ex7.htm

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,28 +44,26 @@
4444
<body>
4545

4646
<div id="code-example" style="display:none">
47-
// Box object names.
48-
var boxGray, boxRed, boxOrange
49-
47+
// First running function.
5048
var start = function() {
5149

5250
// BOX: Gray box. Parameters: (left, top, width, height)
53-
boxGray = createBox(0, 0, 120, 120)
51+
page.boxGray = createBox(0, 0, 120, 120)
5452
that.color = "lightgray"
5553
that.center()
5654

5755
// BOX: Red box.
58-
boxRed = createBox(0, 0, 120, 120)
56+
page.boxRed = createBox(0, 0, 120, 120)
5957
that.color = "orangered"
60-
that.aline(boxGray, "right", 4)
58+
that.aline(page.boxGray, "right", 4)
6159

6260
// BOX: Orange box.
63-
boxOrange = createBox(0, 0, 40, 40)
61+
page.boxOrange = createBox(0, 0, 40, 40)
6462
that.color = "orange"
6563
that.round = 40
6664
that.border = 6
6765
that.borderColor = "rgba(0, 0, 0, 0.2)"
68-
that.aline(boxGray, "bottom", 20, "center")
66+
that.aline(page.boxGray, "bottom", 20, "center")
6967

7068
page.onResize(pageResized)
7169

@@ -74,9 +72,9 @@
7472
var pageResized = function() {
7573

7674
// Recalculate the position of the boxes.
77-
boxGray.center()
78-
boxRed.aline(boxGray, "right", 4)
79-
boxOrange.aline(boxGray, "bottom", 20, "center")
75+
page.boxGray.center()
76+
page.boxRed.aline(boxGray, "right", 4)
77+
page.boxOrange.aline(boxGray, "bottom", 20, "center")
8078

8179
}
8280
</div>

ex8.htm

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,17 @@
4444
<body>
4545

4646
<div id="code-example" style="display:none">
47-
// Box object names.
48-
var boxGray, boxRed
49-
47+
// First running function.
5048
var start = function() {
5149

5250
// BOX: Gray box. Parameters: (left, top, width, height)
53-
boxGray = createBox(0, 0, 120, 120)
51+
page.boxGray = createBox(0, 0, 120, 120)
5452
that.color = "lightgray"
5553
that.center()
5654

5755
// BOX: Red box. Parameters: (left, top, width, height)
58-
boxRed = createBox(0, 0, 50, 50)
59-
boxGray.add(that)
56+
page.boxRed = createBox(0, 0, 50, 50)
57+
page.boxGray.add(that)
6058
that.color = "orangered"
6159
that.center()
6260

@@ -65,10 +63,8 @@
6563
}
6664

6765
var pageResized = function() {
68-
6966
// Recalculate the position of the box.
70-
boxGray.center()
71-
67+
page.boxGray.center()
7268
}
7369
</div>
7470

0 commit comments

Comments
 (0)