zimjs 16.0.2 → 16.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -2
- package/package.json +2 -2
- package/src/zim.js +167 -35
- package/ts-src/typings/zim/index.d.ts +2 -2
package/README.md
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
 
|
|
3
3
|
[](https://discord.com/invite/KczUuFkZdk)
|
|
4
4
|
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
|
|
5
8
|
JavaScript Canvas Framework - Code Creativity!<br>
|
|
6
9
|
https://zimjs.com
|
|
7
10
|
|
|
@@ -11,6 +14,9 @@ Please see the About section for why we use ZIM to make Interactive Media.<br>
|
|
|
11
14
|
https://zimjs.com/about.html
|
|
12
15
|
|
|
13
16
|
## Examples
|
|
17
|
+
|
|
18
|
+

|
|
19
|
+
|
|
14
20
|
ZIM is great for games, puzzles, art, visualizations, interfaces and more! See:<br>
|
|
15
21
|
https://zimjs.com/examples.html<br>
|
|
16
22
|
|
|
@@ -69,6 +75,14 @@ https://zimjs.com/docs.html
|
|
|
69
75
|
|
|
70
76
|
## NPM
|
|
71
77
|
Here is ZIM on NPM: https://www.npmjs.com/package/zimjs<br>
|
|
78
|
+
There are additional helper modules matching the CDN helper modules:<br>
|
|
79
|
+
<a href=https://www.npmjs.com/package/@zimjs/physics>@zimjs/physics</a> |
|
|
80
|
+
<a href=https://www.npmjs.com/package/@zimjs/game>@zimjs/game</a> |
|
|
81
|
+
<a href=https://www.npmjs.com/package/@zimjs/three>@zimjs/three</a> |
|
|
82
|
+
<a href=https://www.npmjs.com/package/@zimjs/socket>@zimjs/socket</a> |
|
|
83
|
+
<a href=https://www.npmjs.com/package/@zimjs/cam>@zimjs/cam</a> |
|
|
84
|
+
<a href=https://www.npmjs.com/package/@zimjs/pizzazz>@zimjs/pizzazz</a>
|
|
85
|
+
<br><br>
|
|
72
86
|
These steps describe setting up ZIM with Vite and NPM for vanilla JavaScript or TypeScript.<br>
|
|
73
87
|
There are also templates for VUE, Svelte, React and Angular further down.
|
|
74
88
|
|
|
@@ -180,6 +194,9 @@ F. OTHER FRAMEWORKS
|
|
|
180
194
|
- The setup is the same as above but the app code is as follows
|
|
181
195
|
|
|
182
196
|
## VUE, SVELTE, REACT, ANGULAR
|
|
197
|
+
|
|
198
|
+

|
|
199
|
+
|
|
183
200
|
ZIM can be used in other frameworks. Thank you <a href=https://github.com/yoanhg421>@yoanhg421</a> for the setup<br>
|
|
184
201
|
See https://github.com/yoanhg421/zimjs-templates for full files.<br>
|
|
185
202
|
Follow the SETUP instructions above and then adjust the code as follows:<br>
|
|
@@ -443,9 +460,9 @@ export class AppComponent implements OnDestroy, AfterContentInit {
|
|
|
443
460
|
```
|
|
444
461
|
|
|
445
462
|
## Issues & Community
|
|
446
|
-
You are welcome to add issues here but we tend to use
|
|
463
|
+
You are welcome to add issues here but we tend to use our Forum for issues and support<br>
|
|
447
464
|
We would love to see you there!<br>
|
|
448
|
-
https://zimjs.com
|
|
465
|
+
https://forum.zimjs.com<br>
|
|
449
466
|
<br>
|
|
450
467
|
You are welcome to join us on Discord as well<br>
|
|
451
468
|
https://zimjs.com/discord<br>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zimjs",
|
|
3
|
-
"version": "16.0.
|
|
3
|
+
"version": "16.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/zim.js",
|
|
6
6
|
"types": "./ts-src/typings/zim",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"typescript": "^4.5.2"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@
|
|
12
|
+
"@zimjs/createjs": "^1.4.1"
|
|
13
13
|
},
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
package/src/zim.js
CHANGED
|
@@ -964,8 +964,8 @@ NOTE: as of ZIM 5.5.0 the zim namespace is no longer required (unless zns is set
|
|
|
964
964
|
EXAMPLE
|
|
965
965
|
if (odds(20)) new Rectangle().center(); // 20% the time there will be a Rectangle
|
|
966
966
|
|
|
967
|
-
if (odds())
|
|
968
|
-
else
|
|
967
|
+
if (odds()) new Aud("yay.mp3").play(); // half the time play yay otherwise play boo
|
|
968
|
+
else new Aud("boo.mp3").play();
|
|
969
969
|
END EXAMPLE
|
|
970
970
|
|
|
971
971
|
PARAMETERS
|
|
@@ -13414,7 +13414,7 @@ zim.Uniforms = function(obj) {
|
|
|
13414
13414
|
if (!Array.isArray(val)) val = [val];
|
|
13415
13415
|
zim.loop(val, function(item, i, t) {
|
|
13416
13416
|
if (t==1) {
|
|
13417
|
-
|
|
13417
|
+
obj[name] = that[name];
|
|
13418
13418
|
} else {
|
|
13419
13419
|
val[i] = that[name + "_" + suf[i]];
|
|
13420
13420
|
}
|
|
@@ -16107,9 +16107,19 @@ Note the points property has been split into points and pointObjects (and there
|
|
|
16107
16107
|
if (color.type) that.color = color;
|
|
16108
16108
|
|
|
16109
16109
|
var startPosition;
|
|
16110
|
+
var mDown = false;
|
|
16110
16111
|
sets.on("mousedown", function(e) {
|
|
16111
16112
|
stage = e.target.stage;
|
|
16112
16113
|
if (that.lockControls) return;
|
|
16114
|
+
mDown = true;
|
|
16115
|
+
sets.loop(function(set) {
|
|
16116
|
+
if (set == e.target.parent) return;
|
|
16117
|
+
if (set.lastChildren==null) set.lastChildren = set.mouseChildren;
|
|
16118
|
+
if (set.lastMouse==null) set.lastMouse = set.mouseEnabled;
|
|
16119
|
+
set.noMouse();
|
|
16120
|
+
});
|
|
16121
|
+
if (shape.lastMouse==null) shape.lastMouse = shape.mouseEnabled;
|
|
16122
|
+
shape.mouseEnabled = false;
|
|
16113
16123
|
if (that.selectPoints) that.keyFocus = true;
|
|
16114
16124
|
startPosition = {x:e.target.x, y:e.target.y};
|
|
16115
16125
|
if (e.target.rect1) { // then mousedown on ball - which has a rect1
|
|
@@ -16203,6 +16213,16 @@ Note the points property has been split into points and pointObjects (and there
|
|
|
16203
16213
|
|
|
16204
16214
|
sets.on("pressup", function(e) {
|
|
16205
16215
|
if (that.lockControls) return;
|
|
16216
|
+
mDown = false;
|
|
16217
|
+
sets.loop(function(set) {
|
|
16218
|
+
if (set == e.target.parent) return;
|
|
16219
|
+
if (set.lastChildren!=null) set.mouseChildren = set.lastChildren;
|
|
16220
|
+
if (set.lastMouse!=null) set.mouseEnabled = set.lastMouse;
|
|
16221
|
+
set.lastChildren = null;
|
|
16222
|
+
set.lastMouse = null;
|
|
16223
|
+
});
|
|
16224
|
+
if (shape.lastMouse!=null) shape.mouseEnabled = shape.lastMouse;
|
|
16225
|
+
shape.lastMouse = null;
|
|
16206
16226
|
var moveControlCheck = (e.target.x != startPosition.x || e.target.y != startPosition.y);
|
|
16207
16227
|
var ev = new createjs.Event("change");
|
|
16208
16228
|
if (e.target.rect1) { // pressup on ball
|
|
@@ -16473,7 +16493,7 @@ Note the points property has been split into points and pointObjects (and there
|
|
|
16473
16493
|
stage = that.stage;
|
|
16474
16494
|
if (that.toggleStageEvent) stage.off("stagemousedown", that.toggleStageEvent);
|
|
16475
16495
|
that.toggleStageEvent = stage.on("stagemousedown", function(e) {
|
|
16476
|
-
if (!that.allowToggle || !that.stage) return;
|
|
16496
|
+
if (mDown || !that.allowToggle || !that.stage) return;
|
|
16477
16497
|
if (_controls && !that.hitTestPoint(e.stageX/zim.scaX, e.stageY/zim.scaY, false)) {
|
|
16478
16498
|
that.hideControls();
|
|
16479
16499
|
that.dispatchEvent("controlshide");
|
|
@@ -18307,8 +18327,18 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
18307
18327
|
if (color.type) that.color = color;
|
|
18308
18328
|
|
|
18309
18329
|
var startPosition;
|
|
18330
|
+
var mDown;
|
|
18310
18331
|
sets.on("mousedown", function(e) {
|
|
18311
18332
|
if (that.lockControls) return;
|
|
18333
|
+
sets.loop(function(set) {
|
|
18334
|
+
if (set == e.target.parent) return;
|
|
18335
|
+
if (set.lastChildren==null) set.lastChildren = set.mouseChildren;
|
|
18336
|
+
if (set.lastMouse==null) set.lastMouse = set.mouseEnabled;
|
|
18337
|
+
set.noMouse();
|
|
18338
|
+
});
|
|
18339
|
+
if (shape.lastMouse==null) shape.lastMouse = shape.mouseEnabled;
|
|
18340
|
+
shape.mouseEnabled = false;
|
|
18341
|
+
mDown = true;
|
|
18312
18342
|
if (that.selectPoints) that.keyFocus = true;
|
|
18313
18343
|
startPosition = {x:e.target.x, y:e.target.y};
|
|
18314
18344
|
var ball;
|
|
@@ -18402,9 +18432,18 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
18402
18432
|
}
|
|
18403
18433
|
});
|
|
18404
18434
|
|
|
18405
|
-
|
|
18406
18435
|
sets.on("pressup", function(e) {
|
|
18407
18436
|
if (that.lockControls) return;
|
|
18437
|
+
sets.loop(function(set) {
|
|
18438
|
+
if (set == e.target.parent) return;
|
|
18439
|
+
if (set.lastChildren!=null) set.mouseChildren = set.lastChildren;
|
|
18440
|
+
if (set.lastMouse!=null) set.mouseEnabled = set.lastMouse;
|
|
18441
|
+
set.lastChildren = null;
|
|
18442
|
+
set.lastMouse = null;
|
|
18443
|
+
});
|
|
18444
|
+
if (shape.lastMouse!=null) shape.mouseEnabled = shape.lastMouse;
|
|
18445
|
+
shape.lastMouse = null;
|
|
18446
|
+
mDown = false;
|
|
18408
18447
|
var moveControlCheck = (e.target.x != startPosition.x || e.target.y != startPosition.y);
|
|
18409
18448
|
var ev = new createjs.Event("change");
|
|
18410
18449
|
if (e.target.rect1) { // pressup on ball
|
|
@@ -18633,7 +18672,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
18633
18672
|
stage = that.stage;
|
|
18634
18673
|
if (that.toggleStageEvent) that.stage.off("stagemousedown", that.toggleStageEvent);
|
|
18635
18674
|
that.toggleStageEvent = that.stage.on("stagemousedown", function(e) {
|
|
18636
|
-
if (!that.allowToggle || !that.stage) return;
|
|
18675
|
+
if (mDown || !that.allowToggle || !that.stage) return;
|
|
18637
18676
|
if (_controls && !that.hitTestPoint(e.stageX/zim.scaX, e.stageY/zim.scaY, false)) {
|
|
18638
18677
|
that.hideControls();
|
|
18639
18678
|
that.dispatchEvent("controlshide");
|
|
@@ -23380,7 +23419,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
23380
23419
|
color = zik(color);
|
|
23381
23420
|
rollColor = zik(rollColor);
|
|
23382
23421
|
downColor = zik(downColor);
|
|
23383
|
-
|
|
23422
|
+
|
|
23384
23423
|
var timeType = zot(WW.TIME) ? zot(zim.TIME) ? "seconds" : zim.TIME : WW.TIME;
|
|
23385
23424
|
|
|
23386
23425
|
var originalBorderColor = borderColor;
|
|
@@ -48746,6 +48785,7 @@ zim.transform = function(obj, move, stretchX, stretchY, scale, rotate, allowTogg
|
|
|
48746
48785
|
}
|
|
48747
48786
|
}
|
|
48748
48787
|
var toggleStageEvent = stage.on("stagemousedown", function(e) {
|
|
48788
|
+
if (mCheck) return;
|
|
48749
48789
|
var underPoint = stage.getObjectUnderPoint(e.stageX, e.stageY, 1);
|
|
48750
48790
|
var layerPress = (underPoint && underPoint.parent && underPoint.parent.layer && underPoint.parent.layer == obj);
|
|
48751
48791
|
|
|
@@ -48826,14 +48866,63 @@ zim.transform = function(obj, move, stretchX, stretchY, scale, rotate, allowTogg
|
|
|
48826
48866
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
48827
48867
|
// transform functions
|
|
48828
48868
|
|
|
48869
|
+
function mOff(current, control) {
|
|
48870
|
+
if (control == current) return;
|
|
48871
|
+
if (control.lastChildren==null) control.lastChildren = control.mouseChildren;
|
|
48872
|
+
if (control.lastMouse==null) control.lastMouse = control.mouseEnabled;
|
|
48873
|
+
control.mouseChildren = false;
|
|
48874
|
+
control.mouseEnabled = false;
|
|
48875
|
+
}
|
|
48876
|
+
|
|
48877
|
+
function mOn(current, control) {
|
|
48878
|
+
if (control == current) return;
|
|
48879
|
+
if (control.lastChildren!=null) control.mouseChildren = control.lastChildren;
|
|
48880
|
+
if (control.lastMouse!=null) control.mouseEnabled = control.lastMouse;
|
|
48881
|
+
}
|
|
48882
|
+
|
|
48883
|
+
function offObjects(target) {
|
|
48884
|
+
mCheck = true; // stagemouse up does not remove so works with multitouch
|
|
48885
|
+
squares.loop(function(control){mOff(target, control);});
|
|
48886
|
+
sidesH.loop(function(control){mOff(target,control);});
|
|
48887
|
+
sidesV.loop(function(control){mOff(target, control);});
|
|
48888
|
+
rotators.loop(function(control){mOff(target, control);});
|
|
48889
|
+
if (target == dragger) return;
|
|
48890
|
+
if (dragger && dragger.lastMouse==null) {
|
|
48891
|
+
dragger.lastMouse = dragger.mouseEnabled;
|
|
48892
|
+
obj.lastMouse = obj.dragPaused;
|
|
48893
|
+
}
|
|
48894
|
+
dragger.mouseEnabled = false;
|
|
48895
|
+
obj.dragPaused = true;
|
|
48896
|
+
}
|
|
48897
|
+
|
|
48898
|
+
function onObjects(target) {
|
|
48899
|
+
mCheck = false;
|
|
48900
|
+
squares.loop(function(control){mOn(target, control);});
|
|
48901
|
+
sidesH.loop(function(control){mOn(target,control);});
|
|
48902
|
+
sidesV.loop(function(control){mOn(target, control);});
|
|
48903
|
+
rotators.loop(function(control){mOn(target, control);});
|
|
48904
|
+
if (target == dragger) return;
|
|
48905
|
+
if (dragger && dragger.lastMouse!=null) {
|
|
48906
|
+
dragger.mouseEnabled = dragger.lastMouse;
|
|
48907
|
+
obj.dragPaused = obj.lastMouse;
|
|
48908
|
+
}
|
|
48909
|
+
dragger.lastMouse = null;
|
|
48910
|
+
}
|
|
48911
|
+
|
|
48912
|
+
var mCheck = false;
|
|
48829
48913
|
function transformMousedown(e) {
|
|
48830
|
-
|
|
48914
|
+
|
|
48915
|
+
offObjects(e.target);
|
|
48916
|
+
|
|
48917
|
+
mousePress = true; // stagemouse up removes... may be broken with multitouch
|
|
48831
48918
|
if (onTop) {
|
|
48832
48919
|
upTop();
|
|
48833
48920
|
// obj.parent.setChildIndex(obj, obj.parent.numChildren-1);
|
|
48834
48921
|
// stage.addChild(controls);
|
|
48835
48922
|
}
|
|
48836
|
-
|
|
48923
|
+
|
|
48924
|
+
if (mousemoveEvent) stage.off("stagemousemove", mousemoveEvent);
|
|
48925
|
+
|
|
48837
48926
|
startX = e.target.x;
|
|
48838
48927
|
startY = e.target.y;
|
|
48839
48928
|
objStartX = obj.x;
|
|
@@ -48873,7 +48962,7 @@ zim.transform = function(obj, move, stretchX, stretchY, scale, rotate, allowTogg
|
|
|
48873
48962
|
carrier2.addTo(container, 1).pos({x:pp.x, y:pp.y, reg:true});
|
|
48874
48963
|
}
|
|
48875
48964
|
dragger.visible = false;
|
|
48876
|
-
obj.cursor = "none";
|
|
48965
|
+
obj.cursor = "none";
|
|
48877
48966
|
}
|
|
48878
48967
|
|
|
48879
48968
|
function scalePressmove(e) {
|
|
@@ -48940,6 +49029,9 @@ zim.transform = function(obj, move, stretchX, stretchY, scale, rotate, allowTogg
|
|
|
48940
49029
|
}
|
|
48941
49030
|
|
|
48942
49031
|
function pressUp(e, reset) {
|
|
49032
|
+
|
|
49033
|
+
onObjects(e.target);
|
|
49034
|
+
|
|
48943
49035
|
setRotators();
|
|
48944
49036
|
var type = e ? e.target.controlType : "move";
|
|
48945
49037
|
if (reset) type = "reset";
|
|
@@ -49135,7 +49227,10 @@ zim.transform = function(obj, move, stretchX, stretchY, scale, rotate, allowTogg
|
|
|
49135
49227
|
stage.update();
|
|
49136
49228
|
});
|
|
49137
49229
|
}
|
|
49138
|
-
dragger.on("mousedown",
|
|
49230
|
+
dragger.on("mousedown", function(){
|
|
49231
|
+
offObjects(dragger);
|
|
49232
|
+
upTop();
|
|
49233
|
+
});
|
|
49139
49234
|
dragger.on("pressmove", function(e) {
|
|
49140
49235
|
if (!obj.transformControls.visible) return;
|
|
49141
49236
|
var point;
|
|
@@ -49150,6 +49245,7 @@ zim.transform = function(obj, move, stretchX, stretchY, scale, rotate, allowTogg
|
|
|
49150
49245
|
}
|
|
49151
49246
|
});
|
|
49152
49247
|
dragger.on("pressup", function(e){
|
|
49248
|
+
onObjects(dragger);
|
|
49153
49249
|
if (!obj.transformControls.visible) return;
|
|
49154
49250
|
pressUp(e);
|
|
49155
49251
|
});
|
|
@@ -49157,30 +49253,34 @@ zim.transform = function(obj, move, stretchX, stretchY, scale, rotate, allowTogg
|
|
|
49157
49253
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
49158
49254
|
// Stage Mouse Up
|
|
49159
49255
|
var stageUpEvent = stage.on("stagemouseup", function() {
|
|
49160
|
-
|
|
49161
|
-
|
|
49162
|
-
|
|
49163
|
-
|
|
49164
|
-
if (
|
|
49165
|
-
transformEvent
|
|
49166
|
-
|
|
49167
|
-
|
|
49256
|
+
setTimeout(function() {
|
|
49257
|
+
if (mCheck) return;
|
|
49258
|
+
mousePress = false;
|
|
49259
|
+
dragger.mouseEnabled = true;
|
|
49260
|
+
if (!dragReady) {
|
|
49261
|
+
transformEvent = new createjs.Event("transformed");
|
|
49262
|
+
if (obj.x != startProperties.x || obj.y != startProperties.y) {
|
|
49263
|
+
transformEvent.transformType = "move";
|
|
49264
|
+
} else {
|
|
49265
|
+
transformEvent.transformType = "select";
|
|
49266
|
+
}
|
|
49267
|
+
transformEvent.pressup = true;
|
|
49268
|
+
obj.dispatchEvent(transformEvent);
|
|
49168
49269
|
}
|
|
49169
|
-
|
|
49170
|
-
|
|
49171
|
-
|
|
49172
|
-
|
|
49173
|
-
|
|
49174
|
-
|
|
49175
|
-
|
|
49176
|
-
obj.rotation = Math.round(obj.rotation/snapRotation)*snapRotation;
|
|
49177
|
-
makeControls();
|
|
49270
|
+
dragReady = true;
|
|
49271
|
+
dragger.visible = true;
|
|
49272
|
+
if (rotateCheck) {
|
|
49273
|
+
if (!frame.ctrlKey && snapRotation > 1) { // snap if not control
|
|
49274
|
+
obj.rotation = Math.round(obj.rotation/snapRotation)*snapRotation;
|
|
49275
|
+
makeControls();
|
|
49276
|
+
}
|
|
49178
49277
|
}
|
|
49179
|
-
|
|
49180
|
-
|
|
49181
|
-
|
|
49182
|
-
|
|
49183
|
-
|
|
49278
|
+
drawDragger();
|
|
49279
|
+
dragger.mouseEnabled = true;
|
|
49280
|
+
rotateCheck = false;
|
|
49281
|
+
stage.update();
|
|
49282
|
+
},50);
|
|
49283
|
+
|
|
49184
49284
|
});
|
|
49185
49285
|
|
|
49186
49286
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
@@ -69477,6 +69577,19 @@ const dPad = new DPad().pos(40,40,LEFT,BOTTOM);
|
|
|
69477
69577
|
ball.control(dPad, 80);
|
|
69478
69578
|
END EXAMPLE
|
|
69479
69579
|
|
|
69580
|
+
EXAMPLE
|
|
69581
|
+
// attach a physics object to a ZIM object
|
|
69582
|
+
// this is like a mousejoint similar to drag() but attached to an object rather than the mouse
|
|
69583
|
+
// so a physics object can follow a ZIM drag() or animate() or wiggle(), etc.
|
|
69584
|
+
// the original distance between the objects is maintained like a distance joint
|
|
69585
|
+
// see https://zimjs.com/valentines/puppet.html
|
|
69586
|
+
// see https://zimjs.com/valentines/puppets2.html
|
|
69587
|
+
const physics = new Physics(0);
|
|
69588
|
+
const control = new Triangle().center().mov(0,-100).drag(); // or animate() or wiggle()
|
|
69589
|
+
const ball = new Circle().center().addPhysics();
|
|
69590
|
+
physics.attach(control, ball); // physics ball will be moved by triangle
|
|
69591
|
+
END EXAMPLE
|
|
69592
|
+
|
|
69480
69593
|
PARAMETERS - FOR PHYSICS
|
|
69481
69594
|
** supports DUO - parameters or single object with properties below
|
|
69482
69595
|
gravity - (default 10) the gravity force in the downward direction
|
|
@@ -69513,6 +69626,12 @@ join(obj1, obj2, point1, point2, minAngle, maxAngle, type) - creates and returns
|
|
|
69513
69626
|
set to "weld" to fix the objects together
|
|
69514
69627
|
break(joint) - break a joint created with join()
|
|
69515
69628
|
to use, store the result of the join() method in a variable and pass that variable in to break()
|
|
69629
|
+
attach(control, obj) attach a physics object (obj) to a ZIM object (control) to like a mousejoint to the ZIM object not the mouse
|
|
69630
|
+
the control can then be animated, wiggled, dragged and the physics object will follow it
|
|
69631
|
+
returns an id to be able to unattach
|
|
69632
|
+
const id = physics.attach(triangle, circle);
|
|
69633
|
+
timeout(2, ()=>{physics.unattach(id)});
|
|
69634
|
+
unattach(id) unattach a physics object from the ZIM object based on the stored id from attach();
|
|
69516
69635
|
debug() - activates the debugging - returns object for chaining
|
|
69517
69636
|
updateDebug() - updates the debug canvas if the frame has been scaled (put in frame resize event)
|
|
69518
69637
|
removeDebug() - removes the debug canvas - you can add it again later (or toggle, etc.)
|
|
@@ -72362,7 +72481,8 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
72362
72481
|
this.zimContainer_constructor(w,h);
|
|
72363
72482
|
this.type = "Flipper"; // need to get styles before constructor but must set type after calling constructor
|
|
72364
72483
|
|
|
72365
|
-
|
|
72484
|
+
var timeType = getTIME(time);
|
|
72485
|
+
if (zot(time)) time = DS.time!=null?DS.time:timeType=="s"?.2:200;
|
|
72366
72486
|
if (zot(vertical)) vertical = DS.vertical!=null?DS.vertical:false;
|
|
72367
72487
|
if (zot(interactive)) interactive = DS.interactive!=null?DS.interactive:false;
|
|
72368
72488
|
if (zot(flipped)) flipped = DS.flipped!=null?DS.flipped:false;
|
|
@@ -84377,13 +84497,25 @@ END EXAMPLE
|
|
|
84377
84497
|
|
|
84378
84498
|
EXAMPLE
|
|
84379
84499
|
// use a Google font https://fonts.google.com/ and apply it with a STYLE
|
|
84380
|
-
|
|
84500
|
+
// previously, the whole URL was needed:
|
|
84501
|
+
// new Frame(FIT, 1024, 768, red, dark, ready, "https://fonts.googleapis.com/css?family=Dancing+Script");
|
|
84502
|
+
// now, the gf_ shortcut can be used:
|
|
84503
|
+
new Frame(FIT, 1024, 768, red, dark, ready, "gf_Dancing+Script");
|
|
84381
84504
|
function ready() {
|
|
84382
84505
|
STYLE = {font:"Dancing Script"}; // or include + but not necessary.
|
|
84383
84506
|
new Label("Custom Google Font").center();
|
|
84384
84507
|
new Label("Second Custom Google Font").center().mov(0,100);
|
|
84385
84508
|
}
|
|
84386
84509
|
END EXAMPLE
|
|
84510
|
+
|
|
84511
|
+
EXAMPLE
|
|
84512
|
+
// with loadAssets, the previous example would be:
|
|
84513
|
+
loadAssets("gf_Dancing+Script");
|
|
84514
|
+
F.complete(()=>{
|
|
84515
|
+
new Label("Custom Google Font", 50, "Dancing Script").center();
|
|
84516
|
+
S.update();
|
|
84517
|
+
});
|
|
84518
|
+
END EXAMPLE
|
|
84387
84519
|
--*///+83.85
|
|
84388
84520
|
// Fonts are used by Label objects and components with label objects and are loaded
|
|
84389
84521
|
// during Frame asset load or loadAssets() so load fonts there
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
// FIXES
|
|
21
21
|
// If you have any issues using the typing please contact us on GitHub
|
|
22
22
|
// https://github.com/danzen/zimjs/issues/26
|
|
23
|
-
// Or join our
|
|
24
|
-
//
|
|
23
|
+
// Or join our Forum and post in the requests channel:
|
|
24
|
+
// https://forum.zimjs.com
|
|
25
25
|
|
|
26
26
|
declare global {
|
|
27
27
|
|