zimjs 17.3.0 → 17.3.2
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/package.json +2 -2
- package/src/zim.js +484 -55
- package/ts-src/typings/zim/index.d.ts +7 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zimjs",
|
|
3
|
-
"version": "17.3.
|
|
3
|
+
"version": "17.3.2",
|
|
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
|
-
"@zimjs/createjs": "^1.
|
|
12
|
+
"@zimjs/createjs": "^1.5.0"
|
|
13
13
|
},
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
package/src/zim.js
CHANGED
|
@@ -732,7 +732,7 @@ RETURNS a Tile or an array of Bitmaps depending on tile parameter
|
|
|
732
732
|
};//-7.8
|
|
733
733
|
|
|
734
734
|
/*--
|
|
735
|
-
zim.shuffle = function(array)
|
|
735
|
+
zim.shuffle = function(array, different)
|
|
736
736
|
|
|
737
737
|
shuffle
|
|
738
738
|
zim function
|
|
@@ -770,10 +770,20 @@ RETURNS the modified Array
|
|
|
770
770
|
var i = array.length, j, temp;
|
|
771
771
|
if (i == 0) return array;
|
|
772
772
|
if (different) {
|
|
773
|
-
var
|
|
774
|
-
|
|
775
|
-
|
|
773
|
+
var sur = {};
|
|
774
|
+
var arr = [];
|
|
775
|
+
for (var i=0; i<array.length; i++) {
|
|
776
|
+
sur[i] = array[i];
|
|
777
|
+
arr.push(i);
|
|
778
|
+
}
|
|
779
|
+
var original = zim.copy(arr);
|
|
780
|
+
zim.shuffle(arr);
|
|
781
|
+
while (zim.arraysEqual(original, arr)) {
|
|
782
|
+
zim.shuffle(arr);
|
|
776
783
|
}
|
|
784
|
+
for (i=0; i<arr.length; i++) {
|
|
785
|
+
array[i] = sur[arr[i]];
|
|
786
|
+
}
|
|
777
787
|
return array;
|
|
778
788
|
} else {
|
|
779
789
|
while(--i) {
|
|
@@ -2424,7 +2434,8 @@ zim function
|
|
|
2424
2434
|
|
|
2425
2435
|
DESCRIPTION
|
|
2426
2436
|
Converts color to HEX - for example: "#333333"
|
|
2427
|
-
Converts color to HEX NUMBER - for example:
|
|
2437
|
+
Converts color to HEX NUMBER - for example: 819
|
|
2438
|
+
Converts color to HEX STRING - for example: "0xff333333"
|
|
2428
2439
|
Or converts color to HTML string - for example: "red"
|
|
2429
2440
|
Or converts color to RGB - for example: "rgb(0,0,0)"
|
|
2430
2441
|
Or converts color to RGBA - for example: "rgba(0,0,0,.5)"
|
|
@@ -2444,7 +2455,8 @@ color = convertColor(blue, "rgba", .5); // result is "rgba(80,196,183,0.5)"
|
|
|
2444
2455
|
color = convertColor("rgb(256,256,0)", "rgba", .3); // result is "rgba(256,256,0,.3)"
|
|
2445
2456
|
color = convertColor("rgba(0,0,0,.2)", "rgba", .5); // result is "rgba(0,0,0,.5)"
|
|
2446
2457
|
color = convertColor("rgba(0,0,0,.2)", "hex", .5); // result adds alpha to hex "#00000080"
|
|
2447
|
-
color = convertColor("red", "
|
|
2458
|
+
color = convertColor("red", "hexnumber"); // result is 16467800
|
|
2459
|
+
color = convertColor("red", "hexstring"); // result is "0xff0000"
|
|
2448
2460
|
color = convertColor("rgba(0,0,0,.2)", "array"); // result is [0,0,0,.2]
|
|
2449
2461
|
color = convertColor(blue, "hsl"); // result is [173.28,49.57,54.12] // first is angle then two percentages
|
|
2450
2462
|
color = convertColor(0x00FF00); // result is "#00FF00";
|
|
@@ -2453,11 +2465,12 @@ END EXAMPLE
|
|
|
2453
2465
|
PARAMETERS
|
|
2454
2466
|
color - (default black) the HTML string or HEX color (case insensitive) or HEX number starting with 0x
|
|
2455
2467
|
HEX can be a # followed by 6, 3, 8 or 4 characters (3 or 4 characters will be duplicated to 6 or 8)
|
|
2456
|
-
toColorType - (default "hex") or use "string", "rgb", "rgba", "array", "hsl" (different than "hsv") "zim", "
|
|
2468
|
+
toColorType - (default "hex") or use "string", "rgb", "rgba", "array", "hsl" (different than "hsv") "zim", "hexnumber", "hexstring"
|
|
2457
2469
|
if "string" and color does not match existing HTML string color
|
|
2458
|
-
then will return HEX
|
|
2470
|
+
then will return HEX as string
|
|
2459
2471
|
zim will convert zim rgb to zim string like "blue"
|
|
2460
|
-
|
|
2472
|
+
hexnumber is the color.parseInt(16) - similar to 0x format
|
|
2473
|
+
hexstring is the 0x format as a string
|
|
2461
2474
|
array will give [r,g,b,a] as array
|
|
2462
2475
|
hsl will give [degree, percent, percent] - note, hsv and hsl are similar but only the hue is the same
|
|
2463
2476
|
alpha - (default 1) the alpha used for the "rgba" and "hex" toColorType
|
|
@@ -2557,6 +2570,10 @@ RETURNS a String with the converted color
|
|
|
2557
2570
|
added = alpha != 1?","+alpha:0;
|
|
2558
2571
|
co = getRGB(answer[1]+added);
|
|
2559
2572
|
return parseInt(co[0]+""+co[1]+""+co[2], 16);
|
|
2573
|
+
} else if (toColorType == "hexstring") {
|
|
2574
|
+
added = alpha != 1?","+alpha:0;
|
|
2575
|
+
co = getRGB(answer[1]+added);
|
|
2576
|
+
return "0xff"+co[0]+""+co[1]+""+co[2];
|
|
2560
2577
|
} else if (toColorType == "string") {
|
|
2561
2578
|
color = getRGB(answer[1]).join("").toLowerCase();
|
|
2562
2579
|
index = hex.indexOf(color);
|
|
@@ -2645,6 +2662,15 @@ RETURNS a String with the converted color
|
|
|
2645
2662
|
if (color.charAt(0)=="#") {
|
|
2646
2663
|
return parseInt(color.replace(/^#/, ''), 16);
|
|
2647
2664
|
}
|
|
2665
|
+
} else if (toColorType == "hexstring") {
|
|
2666
|
+
if (color.charAt(0)=="#") {
|
|
2667
|
+
color = color.replace("#","");
|
|
2668
|
+
if (color.length == 3) {
|
|
2669
|
+
color = color.charAt(0)+color.charAt(0)+color.charAt(1)+color.charAt(1)+color.charAt(2)+color.charAt(2);
|
|
2670
|
+
}
|
|
2671
|
+
if (color.length == 6) color = "ff" + color;
|
|
2672
|
+
return "0x" + color.replace(/^#/, '');
|
|
2673
|
+
}
|
|
2648
2674
|
} else {
|
|
2649
2675
|
if (color.charAt(0)=="#") {
|
|
2650
2676
|
color = color.replace("#","");
|
|
@@ -2659,6 +2685,10 @@ RETURNS a String with the converted color
|
|
|
2659
2685
|
else return colors[index];
|
|
2660
2686
|
} else if (toColorType == "hexnumber") {
|
|
2661
2687
|
return parseInt(hex[colors.indexOf(color.toLowerCase())!=-1?colors.indexOf(color):0], 16);
|
|
2688
|
+
} else if (toColorType == "hexstring") {
|
|
2689
|
+
color = hex[colors.indexOf(color.toLowerCase())!=-1?colors.indexOf(color):0];
|
|
2690
|
+
if (color.length == 6) color = "ff" + color;
|
|
2691
|
+
return "0x" + color.replace(/^#/, '');
|
|
2662
2692
|
} else {
|
|
2663
2693
|
added = (alpha!=1)?rgbToHex(Math.round(alpha*255)):"";
|
|
2664
2694
|
return "#"+hex[colors.indexOf(color.toLowerCase())!=-1?colors.indexOf(color):0]+added;
|
|
@@ -8188,6 +8218,323 @@ choices - a reference to the choices object provided as the Pick(choices) parame
|
|
|
8188
8218
|
else return {min:null, max:null}
|
|
8189
8219
|
};//-17.6
|
|
8190
8220
|
|
|
8221
|
+
// SUBSECTION CREATEJS CLASSES
|
|
8222
|
+
|
|
8223
|
+
/*--
|
|
8224
|
+
createjs.BitmapData = function(width, height, transparent, fillColor)
|
|
8225
|
+
|
|
8226
|
+
BitmapData
|
|
8227
|
+
createjs class - DOES NOT extend a DisplayObject
|
|
8228
|
+
|
|
8229
|
+
DESCRIPTION
|
|
8230
|
+
This class and supporting classes (BitmapDataChannel, ColorTransform), come from Adobe Flash .
|
|
8231
|
+
They were ported here: https://github.com/u-kudox/BitmapData_for_EaselJS (thanks u-kudox).
|
|
8232
|
+
These docs come from: https://airsdk.dev/reference/actionscript/3.0/ (thanks Adobe).
|
|
8233
|
+
Under ALL CLASSES select BitmapData - note that each property and method can be selected for information and examples.
|
|
8234
|
+
|
|
8235
|
+
The BitmapData class lets you work with the data (pixels) of a Bitmap object bitmap image.
|
|
8236
|
+
You can use the methods of the BitmapData class to create arbitrarily sized transparent or opaque bitmap images and manipulate them in various ways at runtime.
|
|
8237
|
+
You can also access the BitmapData for a bitmap image that you load with the flash.display.Loader class.
|
|
8238
|
+
This class lets you separate bitmap rendering operations from the internal display updating routines.
|
|
8239
|
+
By manipulating a BitmapData object directly, you can create complex images without incurring the per-frame overhead of constantly redrawing the content from vector data.
|
|
8240
|
+
|
|
8241
|
+
The methods of the BitmapData class support effects that are not available through the filters available to non-bitmap display objects.
|
|
8242
|
+
|
|
8243
|
+
A BitmapData object contains an array of pixel data. This data can represent either a fully opaque bitmap or a transparent bitmap that contains alpha channel data.
|
|
8244
|
+
Either type of BitmapData object is stored as a buffer of 32-bit integers.
|
|
8245
|
+
Each 32-bit integer determines the properties of a single pixel in the bitmap.
|
|
8246
|
+
|
|
8247
|
+
Each 32-bit integer is a combination of four 8-bit channel values (from 0 to 255) that describe
|
|
8248
|
+
the alpha transparency and the red, green, and blue (ARGB) values of the pixel.
|
|
8249
|
+
(For ARGB values, the most significant byte represents the alpha channel value, followed by red, green, and blue.)
|
|
8250
|
+
|
|
8251
|
+
The four channels (alpha, red, green, and blue) are represented as numbers
|
|
8252
|
+
when you use them with the BitmapData.copyChannel() method or the DisplacementMapFilter.componentX and DisplacementMapFilter.componentY properties,
|
|
8253
|
+
and these numbers are represented by the following constants in the BitmapDataChannel class:
|
|
8254
|
+
|
|
8255
|
+
BitmapDataChannel.ALPHA
|
|
8256
|
+
BitmapDataChannel.RED
|
|
8257
|
+
BitmapDataChannel.GREEN
|
|
8258
|
+
BitmapDataChannel.BLUE
|
|
8259
|
+
|
|
8260
|
+
SEE:
|
|
8261
|
+
https://zimjs.com/zapp/Z_X4PYD - coloring a Pic
|
|
8262
|
+
https://zimjs.com/zapp/Z_XMT78 - coloring a Tile
|
|
8263
|
+
https://github.com/u-kudox/BitmapData_for_EaselJS/tree/master/examples
|
|
8264
|
+
|
|
8265
|
+
|
|
8266
|
+
EXAMPLE
|
|
8267
|
+
// coloring a pic with floodFill()
|
|
8268
|
+
new Frame(FIT, 1024, 768, "ai_coloring_groovy.png", "https://zimjs.org/assets/", ready)
|
|
8269
|
+
function ready() {
|
|
8270
|
+
// cache the pic to get a cacheCanvas for the BitmapData
|
|
8271
|
+
const pic = new Pic("ai_coloring_groovy.png").cache();
|
|
8272
|
+
// pic.contrast = 30; // might need to increase contrast
|
|
8273
|
+
// pic.updateCache();
|
|
8274
|
+
|
|
8275
|
+
// Make a new createjs.BitmapData - needs a canvas
|
|
8276
|
+
const bitmapData = new createjs.BitmapData(pic.cacheCanvas);
|
|
8277
|
+
|
|
8278
|
+
// Just a normal ZIM ColorPicker
|
|
8279
|
+
STYLE = {shadowColor:-1, circles:true};
|
|
8280
|
+
const picker = new ColorPicker(300, [red,orange,green,yellow,purple,blue,white], 7)
|
|
8281
|
+
.pos(0,30,CENTER,BOTTOM);
|
|
8282
|
+
|
|
8283
|
+
// Make a Bitmap to show the bitmapData.canvas
|
|
8284
|
+
const bitmap = new Bitmap(bitmapData.canvas)
|
|
8285
|
+
.scaleTo(S,100).center().cur();
|
|
8286
|
+
|
|
8287
|
+
bitmap.on("mousedown", ()=>{
|
|
8288
|
+
|
|
8289
|
+
// convert our mouse point to a point on the bitmap
|
|
8290
|
+
const point = bitmap.globalToLocal(F.mouseX, F.mouseY);
|
|
8291
|
+
|
|
8292
|
+
// avoid pressing on the same color or the border color
|
|
8293
|
+
const currentColor = bitmapData.getPixel(point.x, point.y);
|
|
8294
|
+
if (
|
|
8295
|
+
currentColor == convertColor(picker.selectedColor, 'hexnumber') ||
|
|
8296
|
+
currentColor < convertColor(dark, "hexnumber") // towards black
|
|
8297
|
+
) return;
|
|
8298
|
+
|
|
8299
|
+
// get the colorPicker color as hexstring - needed for floodFill
|
|
8300
|
+
const newColor = convertColor(picker.selectedColor, 'hexstring');
|
|
8301
|
+
|
|
8302
|
+
// do a floodFill from the point with the new color
|
|
8303
|
+
bitmapData.floodFill(point.x, point.y, newColor);
|
|
8304
|
+
|
|
8305
|
+
S.update();
|
|
8306
|
+
});
|
|
8307
|
+
} // end ready
|
|
8308
|
+
END EXAMPLE
|
|
8309
|
+
|
|
8310
|
+
EXAMPLE
|
|
8311
|
+
// coloring a Tile with floodFill()
|
|
8312
|
+
// cache the tile to get a cacheCanvas for the BitmapData
|
|
8313
|
+
STYLE = {color:white, borderColor:black, borderWidth:3, backdropColor:white, backdropPadding:20};
|
|
8314
|
+
const tile = new Tile([new Circle(50), new Rectangle(100,100)],5,4,20,20).cache();
|
|
8315
|
+
|
|
8316
|
+
// Create a new createjs.BitmapData - needs a canvas
|
|
8317
|
+
const bitmapData = new createjs.BitmapData(tile.cacheCanvas);
|
|
8318
|
+
|
|
8319
|
+
// Just a normal ZIM ColorPicker
|
|
8320
|
+
STYLE = {shadowColor:-1};
|
|
8321
|
+
const picker = new ColorPicker(250, [red,orange,green,yellow], 4)
|
|
8322
|
+
.pos(0,30,CENTER,BOTTOM);
|
|
8323
|
+
|
|
8324
|
+
// Make a Bitmap to show the bitmapData.canvas
|
|
8325
|
+
const bitmap = new Bitmap(bitmapData.canvas).center().cur();
|
|
8326
|
+
bitmap.on("mousedown", ()=>{
|
|
8327
|
+
// convert our mouse point to a point on the bitmap
|
|
8328
|
+
const point = bitmap.globalToLocal(F.mouseX, F.mouseY);
|
|
8329
|
+
// avoid pressing on a dark color
|
|
8330
|
+
const currentColor = bitmapData.getPixel(point.x, point.y);
|
|
8331
|
+
if (currentColor<convertColor(dark, "hexnumber")) return;
|
|
8332
|
+
// get the colorPicker color as hexstring - needed for floodFill
|
|
8333
|
+
const newColor = convertColor(picker.selectedColor, 'hexstring');
|
|
8334
|
+
// do a floodFill from the point with the new color
|
|
8335
|
+
bitmapData.floodFill(point.x, point.y, newColor);
|
|
8336
|
+
S.update();
|
|
8337
|
+
});
|
|
8338
|
+
END EXAMPLE
|
|
8339
|
+
|
|
8340
|
+
PARAMETERS
|
|
8341
|
+
width - the width of the bitmap image in pixels.
|
|
8342
|
+
height - the height of the bitmap image in pixels.
|
|
8343
|
+
transparent (default true) - Boolean that defines whether the bitmap image supports per-pixel transparency.
|
|
8344
|
+
fillColor (default 0xffffffff) - the fill color as a HEX Number.
|
|
8345
|
+
|
|
8346
|
+
METHODS
|
|
8347
|
+
** see also https://airsdk.dev/reference/actionscript/3.0/
|
|
8348
|
+
** search under ALL CLASSES for BitmapData - press on methods for details
|
|
8349
|
+
** note - none of these support ZIM DUO as this is a createjs class and methods
|
|
8350
|
+
applyFilter(sourceBitmapData:BitmapData, sourceRect:Rectangle, destPoint:Point, filter:BitmapFilter):void
|
|
8351
|
+
Takes a source image and a filter object and generates the filtered image.
|
|
8352
|
+
clone():BitmapData
|
|
8353
|
+
Returns a new BitmapData object that is a clone of the original instance with an exact copy of the contained bitmap.
|
|
8354
|
+
colorTransform(rect:Rectangle, colorTransform:ColorTransform):void
|
|
8355
|
+
Adjusts the color values in a specified area of a bitmap image by using a ColorTransform object.
|
|
8356
|
+
compare(otherBitmapData:BitmapData):Object
|
|
8357
|
+
Compares two BitmapData objects.
|
|
8358
|
+
convertColorProfile(source:Screen, destination:Screen):BitmapData
|
|
8359
|
+
Create a copy of the image data, converting between color profiles based on the provided Screen objects.
|
|
8360
|
+
copyChannel(sourceBitmapData:BitmapData, sourceRect:Rectangle, destPoint:Point, sourceChannel:uint, destChannel:uint):void
|
|
8361
|
+
Transfers data from one channel of another BitmapData object or the current BitmapData object into a channel of the current BitmapData object.
|
|
8362
|
+
copyPixels(sourceBitmapData:BitmapData, sourceRect:Rectangle, destPoint:Point, alphaBitmapData:BitmapData = null, alphaPoint:Point = null, mergeAlpha:Boolean = false):void
|
|
8363
|
+
Provides a fast routine to perform pixel manipulation between images with no stretching, rotation, or color effects.
|
|
8364
|
+
copyPixelsToByteArray(rect:Rectangle, data:ByteArray):void
|
|
8365
|
+
Fills a byte array from a rectangular region of pixel data.
|
|
8366
|
+
decode(data:ByteArray):BitmapData
|
|
8367
|
+
[static] Decompresses encoded image data (PNG/GIF89a/JPEG) into a new BitmapData object using data provided in a ByteArray.
|
|
8368
|
+
dispose():void
|
|
8369
|
+
Frees memory that is used to store the BitmapData object.
|
|
8370
|
+
draw(source:IBitmapDrawable, matrix:Matrix = null, colorTransform:ColorTransform = null, blendMode:String = null, clipRect:Rectangle = null, smoothing:Boolean = false):void
|
|
8371
|
+
Draws the source display object onto the bitmap image, using the Flash runtime vector renderer.
|
|
8372
|
+
drawWithQuality(source:IBitmapDrawable, matrix:Matrix = null, colorTransform:ColorTransform = null, blendMode:String = null, clipRect:Rectangle = null, smoothing:Boolean = false, quality:String = null):void
|
|
8373
|
+
Draws the source display object onto the bitmap image, using the Flash runtime vector renderer.
|
|
8374
|
+
encode(rect:Rectangle, compressor:Object, byteArray:ByteArray = null):ByteArray
|
|
8375
|
+
Compresses this BitmapData object using the selected compressor algorithm and returns a new ByteArray object.
|
|
8376
|
+
fillRect(rect:Rectangle, color:uint):void
|
|
8377
|
+
Fills a rectangular area of pixels with a specified ARGB color.
|
|
8378
|
+
floodFill(x:int, y:int, color:uint):void
|
|
8379
|
+
Performs a flood fill operation on an image starting at an (x, y) coordinate and filling with a certain color.
|
|
8380
|
+
generateFilterRect(sourceRect:Rectangle, filter:BitmapFilter):Rectangle
|
|
8381
|
+
Determines the destination rectangle that the applyFilter() method call affects, given a BitmapData object, a source rectangle, and a filter object.
|
|
8382
|
+
getColorBoundsRect(mask:uint, color:uint, findColor:Boolean = true):Rectangle
|
|
8383
|
+
Determines a rectangular region that either fully encloses all pixels of a specified color within the bitmap image (if the findColor parameter is set to true) or fully encloses all pixels that do not include the specified color (if the findColor parameter is set to false).
|
|
8384
|
+
getPixel(x:int, y:int):uint
|
|
8385
|
+
Returns an integer that represents an RGB pixel value from a BitmapData object at a specific point (x, y).
|
|
8386
|
+
getPixel32(x:int, y:int):uint
|
|
8387
|
+
Returns an ARGB color value that contains alpha channel data and RGB data.
|
|
8388
|
+
getPixels(rect:Rectangle):ByteArray
|
|
8389
|
+
Generates a byte array from a rectangular region of pixel data.
|
|
8390
|
+
getVector(rect:Rectangle):Vector.<uint>
|
|
8391
|
+
Generates a vector array from a rectangular region of pixel data.
|
|
8392
|
+
histogram(hRect:Rectangle = null):Vector.<Vector.<Number>>
|
|
8393
|
+
Computes a 256-value binary number histogram of a BitmapData object.
|
|
8394
|
+
hitTest(firstPoint:Point, firstAlphaThreshold:uint, secondObject:Object, secondBitmapDataPoint:Point = null, secondAlphaThreshold:uint = 1):Boolean
|
|
8395
|
+
Performs pixel-level hit detection between one bitmap image and a point, rectangle, or other bitmap image.
|
|
8396
|
+
lock():void
|
|
8397
|
+
Locks an image so that any objects that reference the BitmapData object, such as Bitmap objects, are not updated when this BitmapData object changes.
|
|
8398
|
+
merge(sourceBitmapData:BitmapData, sourceRect:Rectangle, destPoint:Point, redMultiplier:uint, greenMultiplier:uint, blueMultiplier:uint, alphaMultiplier:uint):void
|
|
8399
|
+
Performs per-channel blending from a source image to a destination image.
|
|
8400
|
+
noise(randomSeed:int, low:uint = 0, high:uint = 255, channelOptions:uint = 7, grayScale:Boolean = false):void
|
|
8401
|
+
Fills an image with pixels representing random noise.
|
|
8402
|
+
paletteMap(sourceBitmapData:BitmapData, sourceRect:Rectangle, destPoint:Point, redArray:Array = null, greenArray:Array = null, blueArray:Array = null, alphaArray:Array = null):void
|
|
8403
|
+
Remaps the color channel values in an image that has up to four arrays of color palette data, one for each channel.
|
|
8404
|
+
perlinNoise(baseX:Number, baseY:Number, numOctaves:uint, randomSeed:int, stitch:Boolean, fractalNoise:Boolean, channelOptions:uint = 7, grayScale:Boolean = false, offsets:Array = null):void
|
|
8405
|
+
Generates a Perlin noise image.
|
|
8406
|
+
pixelDissolve(sourceBitmapData:BitmapData, sourceRect:Rectangle, destPoint:Point, randomSeed:int = 0, numPixels:int = 0, fillColor:uint = 0):int
|
|
8407
|
+
Performs a pixel dissolve either from a source image to a destination image or by using the same image.
|
|
8408
|
+
scroll(x:int, y:int):void
|
|
8409
|
+
Scrolls an image by a certain (x, y) pixel amount.
|
|
8410
|
+
setPixel(x:int, y:int, color:uint):void
|
|
8411
|
+
Sets a single pixel of a BitmapData object.
|
|
8412
|
+
setPixel32(x:int, y:int, color:uint):void
|
|
8413
|
+
Sets the color and alpha transparency values of a single pixel of a BitmapData object.
|
|
8414
|
+
setPixels(rect:Rectangle, inputByteArray:ByteArray):void
|
|
8415
|
+
Converts a byte array into a rectangular region of pixel data.
|
|
8416
|
+
setVector(rect:Rectangle, inputVector:Vector.<uint>):void
|
|
8417
|
+
Converts a Vector into a rectangular region of pixel data.
|
|
8418
|
+
threshold(sourceBitmapData:BitmapData, sourceRect:Rectangle, destPoint:Point, operation:String, threshold:uint, color:uint = 0, mask:uint = 0xFFFFFFFF, copySource:Boolean = false):uint
|
|
8419
|
+
Tests pixel values in an image against a specified threshold and sets pixels that pass the test to new color values.
|
|
8420
|
+
unlock(changeRect:Rectangle = null):void
|
|
8421
|
+
Unlocks an image so that any objects that reference the BitmapData object, such as Bitmap objects, are updated when this BitmapData object changes.
|
|
8422
|
+
|
|
8423
|
+
PROPERTIES
|
|
8424
|
+
** see also https://airsdk.dev/reference/actionscript/3.0/
|
|
8425
|
+
** search under ALL CLASSES for BitmapData - press on properties for details
|
|
8426
|
+
width - read-only - The width of the bitmap image in pixels.
|
|
8427
|
+
height - read-only - The height of the bitmap image in pixels.
|
|
8428
|
+
rect - read-only - The rectangle that defines the size and location of the bitmap image.
|
|
8429
|
+
transparent - read-only - Boolean that defines whether the bitmap image supports per-pixel transparency.
|
|
8430
|
+
--*///+17.65
|
|
8431
|
+
|
|
8432
|
+
// THE CODE FOR THE METHOD IS IN CREATEJS
|
|
8433
|
+
|
|
8434
|
+
//-17.65
|
|
8435
|
+
|
|
8436
|
+
/*--
|
|
8437
|
+
createjs.BitmapDataChannel = function()
|
|
8438
|
+
|
|
8439
|
+
BitmapDataChannel
|
|
8440
|
+
createjs static class
|
|
8441
|
+
|
|
8442
|
+
DESCRIPTION
|
|
8443
|
+
This class is a supporting class for CreateJS BitmapData. It comes from Adobe Flash.
|
|
8444
|
+
They were ported here: https://github.com/u-kudox/BitmapData_for_EaselJS (thanks u-kudox).
|
|
8445
|
+
These docs come from: https://airsdk.dev/reference/actionscript/3.0/ (thanks Adobe).
|
|
8446
|
+
Under ALL CLASSES select BitmapDataChannel
|
|
8447
|
+
|
|
8448
|
+
The BitmapDataChannel class is an enumeration of constant values that indicate which channel to use: red, blue, green, or alpha transparency.
|
|
8449
|
+
When you call some methods, you can use the bitwise OR operator (|) to combine BitmapDataChannel constants to indicate multiple color channels.
|
|
8450
|
+
|
|
8451
|
+
PROPERTIES
|
|
8452
|
+
ALPHA: uint = 8
|
|
8453
|
+
[static] The alpha channel.
|
|
8454
|
+
BLUE: uint = 4
|
|
8455
|
+
[static] The blue channel.
|
|
8456
|
+
GREEN: uint = 2
|
|
8457
|
+
[static] The green channel.
|
|
8458
|
+
RED: uint = 1
|
|
8459
|
+
[static] The red channel.
|
|
8460
|
+
--*///+17.66
|
|
8461
|
+
|
|
8462
|
+
// THE CODE FOR THE METHOD IS IN CREATEJS
|
|
8463
|
+
|
|
8464
|
+
//-17.66
|
|
8465
|
+
|
|
8466
|
+
/*--
|
|
8467
|
+
createjs.ColorTransform = function(redMultiplier, greenMultiplier, blueMultiplier, alphaMultiplier, redOffset, greenOffset, blueOffset, alphaOffset)
|
|
8468
|
+
|
|
8469
|
+
ColorTransform
|
|
8470
|
+
createjs class
|
|
8471
|
+
|
|
8472
|
+
DESCRIPTION
|
|
8473
|
+
This class is a supporting class for CreateJS BitmapData. It comes from Adobe Flash.
|
|
8474
|
+
They were ported here: https://github.com/u-kudox/BitmapData_for_EaselJS (thanks u-kudox).
|
|
8475
|
+
These docs come from: https://airsdk.dev/reference/actionscript/3.0/ (thanks Adobe).
|
|
8476
|
+
Under ALL CLASSES select ColorTransform
|
|
8477
|
+
|
|
8478
|
+
The ColorTransform class lets you adjust the color values in a display object.
|
|
8479
|
+
The color adjustment or color transformation can be applied to all four channels: red, green, blue, and alpha transparency.
|
|
8480
|
+
When a ColorTransform object is applied to a display object,
|
|
8481
|
+
a new value for each color channel is calculated like this:
|
|
8482
|
+
|
|
8483
|
+
New red value = (old red value * redMultiplier) + redOffset
|
|
8484
|
+
New green value = (old green value * greenMultiplier) + greenOffset
|
|
8485
|
+
New blue value = (old blue value * blueMultiplier) + blueOffset
|
|
8486
|
+
New alpha value = (old alpha value * alphaMultiplier) + alphaOffset
|
|
8487
|
+
If any of the color channel values is greater than 255 after the calculation, it is set to 255. If it is less than 0, it is set to 0.
|
|
8488
|
+
|
|
8489
|
+
You can use ColorTransform objects in the following ways:
|
|
8490
|
+
|
|
8491
|
+
In the colorTransform parameter of the colorTransform() method of the BitmapData class
|
|
8492
|
+
As the colorTransform property of a Transform object (which can be used as the transform property of a display object)
|
|
8493
|
+
You must use the new ColorTransform() constructor to create a ColorTransform object before you can call the methods of the ColorTransform object.
|
|
8494
|
+
|
|
8495
|
+
PARAMETERS
|
|
8496
|
+
** see also https://airsdk.dev/reference/actionscript/3.0/
|
|
8497
|
+
** search under ALL CLASSES for ColorTransform - press on properties for details
|
|
8498
|
+
alphaMultiplier : Number
|
|
8499
|
+
A decimal value that is multiplied with the alpha transparency channel value.
|
|
8500
|
+
alphaOffset : Number
|
|
8501
|
+
A number from -255 to 255 that is added to the alpha transparency channel value after it has been multiplied by the alphaMultiplier value.
|
|
8502
|
+
blueMultiplier : Number
|
|
8503
|
+
A decimal value that is multiplied with the blue channel value.
|
|
8504
|
+
blueOffset : Number
|
|
8505
|
+
A number from -255 to 255 that is added to the blue channel value after it has been multiplied by the blueMultiplier value.
|
|
8506
|
+
color : uint
|
|
8507
|
+
The RGB color value for a ColorTransform object.
|
|
8508
|
+
greenMultiplier : Number
|
|
8509
|
+
A decimal value that is multiplied with the green channel value.
|
|
8510
|
+
greenOffset : Number
|
|
8511
|
+
A number from -255 to 255 that is added to the green channel value after it has been multiplied by the greenMultiplier value.
|
|
8512
|
+
redMultiplier : Number
|
|
8513
|
+
A decimal value that is multiplied with the red channel value.
|
|
8514
|
+
redOffset : Number
|
|
8515
|
+
A number from -255 to 255 that is added to the red channel value after it has been multiplied by the redMultiplier value.
|
|
8516
|
+
|
|
8517
|
+
METHODS
|
|
8518
|
+
** see also https://airsdk.dev/reference/actionscript/3.0/
|
|
8519
|
+
** search under ALL CLASSES for ColorTransform - press on methods for details
|
|
8520
|
+
colorTransform(redMultiplier:Number = 1.0, greenMultiplier:Number = 1.0, blueMultiplier:Number = 1.0, alphaMultiplier:Number = 1.0, redOffset:Number = 0, greenOffset:Number = 0, blueOffset:Number = 0, alphaOffset:Number = 0)
|
|
8521
|
+
Creates a ColorTransform object for a display object with the specified color channel values and alpha values.
|
|
8522
|
+
concat(second:ColorTransform):void
|
|
8523
|
+
Concatenates the ColorTranform object specified by the second parameter with the current ColorTransform object
|
|
8524
|
+
and sets the current object as the result, which is an additive combination of the two color transformations.
|
|
8525
|
+
toString():String
|
|
8526
|
+
Formats and returns a string that describes all of the properties of the ColorTransform object.
|
|
8527
|
+
|
|
8528
|
+
PROPERTIES
|
|
8529
|
+
** see also https://airsdk.dev/reference/actionscript/3.0/
|
|
8530
|
+
** search under ALL CLASSES for ColorTransform - press on properties for details
|
|
8531
|
+
See the parameters - which are all properties
|
|
8532
|
+
--*///+17.67
|
|
8533
|
+
|
|
8534
|
+
// THE CODE FOR THE METHOD IS IN CREATEJS
|
|
8535
|
+
|
|
8536
|
+
//-17.67
|
|
8537
|
+
|
|
8191
8538
|
// DOM CODE
|
|
8192
8539
|
|
|
8193
8540
|
// SUBSECTION HTML FUNCTIONS
|
|
@@ -10363,7 +10710,7 @@ const thumbs = [];
|
|
|
10363
10710
|
const cols = 5;
|
|
10364
10711
|
const rows = 5;
|
|
10365
10712
|
|
|
10366
|
-
const image =
|
|
10713
|
+
const image = new Pic("yourimage.jpg");
|
|
10367
10714
|
const w = image.width/cols;
|
|
10368
10715
|
const h = image.height/cols;
|
|
10369
10716
|
loop(rows, r=>{
|
|
@@ -31616,7 +31963,7 @@ zim.TextInput = function(width, height, placeholder, text, size, font, color, ba
|
|
|
31616
31963
|
return label.color;
|
|
31617
31964
|
},
|
|
31618
31965
|
set: function(value) {
|
|
31619
|
-
label.color =
|
|
31966
|
+
label.color = value;
|
|
31620
31967
|
if ((!zim.OPTIMIZE&&(zns||!WW.OPTIMIZE)) && that.stage) that.stage.update();
|
|
31621
31968
|
}
|
|
31622
31969
|
});
|
|
@@ -40685,6 +41032,12 @@ const cp = new ColorPicker()
|
|
|
40685
41032
|
});
|
|
40686
41033
|
END EXAMPLE
|
|
40687
41034
|
|
|
41035
|
+
EXAMPLE
|
|
41036
|
+
STYLE = {shadowColor:-1, circles:true};
|
|
41037
|
+
const picker = new ColorPicker(300, [red,orange,green,yellow,purple,blue,white], 7)
|
|
41038
|
+
.pos(0,30,CENTER,BOTTOM);
|
|
41039
|
+
END EXAMPLE
|
|
41040
|
+
|
|
40688
41041
|
PARAMETERS
|
|
40689
41042
|
** supports DUO - parameters or single object with properties below
|
|
40690
41043
|
** supports OCT - parameter defaults can be set with STYLE control (like CSS)
|
|
@@ -41183,7 +41536,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
41183
41536
|
"rgb(0 0 255)",
|
|
41184
41537
|
"rgb(255 0 255)",
|
|
41185
41538
|
"rgb(255 0 0)"
|
|
41186
|
-
],[0,1/6,2/6,3/6,4/6,5/6,6/6],0,0,
|
|
41539
|
+
],[0,1/6,2/6,3/6,4/6,5/6,6/6],0,0,that.width,0)).addTo(spect).mov(0,gH-1);
|
|
41187
41540
|
new zim.Rectangle(that.width,cH/2,new zim.GradientColor(["rgba(255,255,255,1)","rgba(255,255,255,0)"],[0,1],0,0,0,cH/2)).loc(main, null, spect);
|
|
41188
41541
|
new zim.Rectangle(that.width,cH/2+.5,new zim.GradientColor(["rgba(0,0,0,1)","rgba(0,0,00,0)"],[1,0],0,0,0,cH/2+.5)).loc(main, null, spect).mov(0,cH/2);
|
|
41189
41542
|
new zim.Rectangle(that.width,20,new zim.GradientColor(["black","white"],[.1,.9],0,0,that.width,0)).addTo(spect);
|
|
@@ -50984,13 +51337,14 @@ RETURNS obj for chaining
|
|
|
50984
51337
|
stCheck = true;
|
|
50985
51338
|
dropListCheck = false;
|
|
50986
51339
|
stage = obj.stage;
|
|
50987
|
-
if (!obj.zmu) obj.zmu = stage.frame.on("mouseupplus", function(e) {
|
|
50988
|
-
if (obj.downCheck) {
|
|
50989
|
-
if
|
|
50990
|
-
|
|
50991
|
-
|
|
51340
|
+
if (!obj.zmu) obj.zmu = stage.frame.on("mouseupplus", function(e) {
|
|
51341
|
+
if (obj.downCheck) {
|
|
51342
|
+
// Note - adjusted the mouseupplus event to delay 30ms if triggered on a mousemove
|
|
51343
|
+
if (!slide) obj.downCheck = false;
|
|
51344
|
+
doUp(e, true); // true for cancel slide
|
|
51345
|
+
}
|
|
50992
51346
|
});
|
|
50993
|
-
|
|
51347
|
+
|
|
50994
51348
|
obj.dragMouseX = Math.round(e.stageX/zim.scaX)+stage.x;
|
|
50995
51349
|
obj.dragMouseY = Math.round(e.stageY/zim.scaY)+stage.y;
|
|
50996
51350
|
var id = "id"+Math.abs(e.pointerID+1);
|
|
@@ -54403,6 +54757,15 @@ EXAMPLE
|
|
|
54403
54757
|
new Circle().center().addPhysics(); // circle will fall with gravity to the floor
|
|
54404
54758
|
END EXAMPLE
|
|
54405
54759
|
|
|
54760
|
+
EXAMPLE
|
|
54761
|
+
// usually, we add a Physics object so we can set gravity, drag, etc.
|
|
54762
|
+
const physics = new Physics().drag(); // turn drag on
|
|
54763
|
+
// center registration for rectangular objects
|
|
54764
|
+
const rect1 = new Rectangle(200,100,purple).reg(CENTER).pos(50,50).addPhysics();
|
|
54765
|
+
const rect2 = new Rectangle(100,200,blue).reg(CENTER).pos(50,50,RIGHT).addPhysics();
|
|
54766
|
+
// physics.debug(); // uncomment to see debug mode
|
|
54767
|
+
END EXAMPLE
|
|
54768
|
+
|
|
54406
54769
|
EXAMPLE
|
|
54407
54770
|
// create a world with no gravity (viewed from top like air-hockey)
|
|
54408
54771
|
const physics = new Physics(0);
|
|
@@ -55312,7 +55675,7 @@ const circles = new Container(W, H).addTo();
|
|
|
55312
55675
|
const circle1 = new Circle(50, red).center(circles);
|
|
55313
55676
|
const circle2 = new Circle(50, blue).center(circles).mov(70);
|
|
55314
55677
|
circles.animate({
|
|
55315
|
-
props:{scale:
|
|
55678
|
+
props:{scale:0},
|
|
55316
55679
|
time:.5,
|
|
55317
55680
|
loop:true,
|
|
55318
55681
|
rewind:true,
|
|
@@ -59893,7 +60256,7 @@ circle.outline();
|
|
|
59893
60256
|
END EXAMPLE
|
|
59894
60257
|
|
|
59895
60258
|
EXAMPLE
|
|
59896
|
-
Dynamic Examples
|
|
60259
|
+
// Dynamic Examples
|
|
59897
60260
|
const ball = new Circle().center().drag({removeTweens:false});
|
|
59898
60261
|
ball.on("mousedown", ()=>{
|
|
59899
60262
|
ball.outline();
|
|
@@ -73701,18 +74064,22 @@ SEE: https://zimjs.com/physics/ for examples
|
|
|
73701
74064
|
NOTE: as of ZIM 5.5.0 the zim namespace is no longer required (unless zns is set to true before running zim)
|
|
73702
74065
|
|
|
73703
74066
|
EXAMPLE
|
|
73704
|
-
//
|
|
73705
|
-
|
|
73706
|
-
|
|
73707
|
-
|
|
73708
|
-
|
|
73709
|
-
|
|
74067
|
+
new Circle().center().addPhysics(); // circle will fall with gravity to the floor
|
|
74068
|
+
END EXAMPLE
|
|
74069
|
+
|
|
74070
|
+
EXAMPLE
|
|
74071
|
+
// usually, we add a Physics object so we can set gravity, drag, etc.
|
|
74072
|
+
const physics = new Physics().drag(); // turn drag on
|
|
74073
|
+
// center registration for rectangular objects
|
|
74074
|
+
const rect1 = new Rectangle(200,100,purple).reg(CENTER).pos(50,50).addPhysics();
|
|
74075
|
+
const rect2 = new Rectangle(100,200,blue).reg(CENTER).pos(50,50,RIGHT).addPhysics();
|
|
74076
|
+
// physics.debug(); // uncomment to see debug mode
|
|
73710
74077
|
END EXAMPLE
|
|
73711
74078
|
|
|
73712
74079
|
EXAMPLE
|
|
73713
74080
|
// create a world with no gravity (viewed from top like air-hockey)
|
|
73714
74081
|
const physics = new Physics(0);
|
|
73715
|
-
const circle = new Circle(50,blue,grey).center().addPhysics({
|
|
74082
|
+
const circle = new Circle(50,blue,grey).center().addPhysics({bounciness:.7});
|
|
73716
74083
|
// make sure to reg(CENTER) or centerReg() any rectangular objects
|
|
73717
74084
|
const rect = new Rectangle(30,400).reg(CENTER).pos(70,0,LEFT,CENTER).addPhysics(false); // static - do not move
|
|
73718
74085
|
const tri = new Triangle(150,150,150,green,grey).pos(200,0,LEFT,CENTER).addPhysics({linear:10}); // does not slide easily
|
|
@@ -73757,19 +74124,19 @@ EXAMPLE
|
|
|
73757
74124
|
import zim from "https://zimjs.org/cdn/017/zim_physics"; // or latest version
|
|
73758
74125
|
new Frame(FIT, 1024, 768, light, dark, ready, "cathead.png", "https://zimjs.org/assets/");
|
|
73759
74126
|
function ready() {
|
|
73760
|
-
|
|
73761
|
-
|
|
74127
|
+
const pic = new Pic("cathead.png").center();
|
|
74128
|
+
const physics = new Physics().drag();
|
|
73762
74129
|
|
|
73763
|
-
|
|
73764
|
-
|
|
73765
|
-
|
|
73766
|
-
|
|
73767
|
-
|
|
73768
|
-
|
|
74130
|
+
const blob = new Blob({
|
|
74131
|
+
points:simplifyPoints(outlineImage(pic), 10), // 10 is the default tolerance
|
|
74132
|
+
color:faint,
|
|
74133
|
+
interactive:false
|
|
74134
|
+
}).loc(pic).addPhysics();
|
|
74135
|
+
pic.addTo(blob);
|
|
73769
74136
|
|
|
73770
|
-
|
|
74137
|
+
zog(physics.validate(blob)); // check validation
|
|
73771
74138
|
|
|
73772
|
-
|
|
74139
|
+
new Circle(50,black).pos(0,100,CENTER).addPhysics();
|
|
73773
74140
|
}
|
|
73774
74141
|
END EXAMPLE
|
|
73775
74142
|
|
|
@@ -73973,12 +74340,18 @@ customControl(dir, speed, speedY) - available only if control() is set.
|
|
|
73973
74340
|
these will then take the place of keys or DPad
|
|
73974
74341
|
noControl() - remove control for an object set with control()
|
|
73975
74342
|
contact(call) - run the call function when object's body contacts another body
|
|
73976
|
-
the callback function receives
|
|
74343
|
+
the callback function receives three parameters
|
|
74344
|
+
the other ZIM object being hit
|
|
74345
|
+
the other ZIM object being hit's Physics body
|
|
74346
|
+
the original ZIM object that the contact method is on
|
|
73977
74347
|
a border will have a type = "Border" and a side = LEFT, RIGHT, TOP, "bottom"
|
|
73978
74348
|
but it is not really a ZIM Rectangle but just an object literal placeholder
|
|
73979
74349
|
Also see sensor parameter to trigger contact but with no physics interaction
|
|
73980
74350
|
contactEnd(call) - run the call function when object's body ends contacts with another body
|
|
73981
|
-
the callback function receives
|
|
74351
|
+
the callback function receives three parameters
|
|
74352
|
+
the other ZIM object being hit
|
|
74353
|
+
the other ZIM object being hit's Physics body
|
|
74354
|
+
the original ZIM object that the contact method is on
|
|
73982
74355
|
a border will have a type = "Border" and a side = LEFT, RIGHT, TOP, "bottom"
|
|
73983
74356
|
but it is not really a ZIM Rectangle but just an object literal placeholder
|
|
73984
74357
|
Also see sensor parameter to trigger contact but with no physics interaction
|
|
@@ -74164,24 +74537,26 @@ b2ContactListener = Box2D.Dynamics.b2ContactListener;
|
|
|
74164
74537
|
WW.zimContactListener.EndContact = endContact;
|
|
74165
74538
|
function beginContact(e) {
|
|
74166
74539
|
var match = zimContactBeginList.at(e.m_fixtureB.GetBody());
|
|
74167
|
-
if (match) match(e.m_fixtureA.GetBody().zimObj, e.m_fixtureA.GetBody());
|
|
74540
|
+
if (match) match(e.m_fixtureA.GetBody().zimObj, e.m_fixtureA.GetBody(), match.obj);
|
|
74168
74541
|
match = zimContactBeginList.at(e.m_fixtureA.GetBody());
|
|
74169
|
-
if (match) match(e.m_fixtureB.GetBody().zimObj, e.m_fixtureB.GetBody());
|
|
74542
|
+
if (match) match(e.m_fixtureB.GetBody().zimObj, e.m_fixtureB.GetBody(), match.obj);
|
|
74170
74543
|
}
|
|
74171
74544
|
function endContact(e) {
|
|
74172
74545
|
var match = zimContactEndList.at(e.m_fixtureB.GetBody());
|
|
74173
|
-
if (match) match(e.m_fixtureA.GetBody().zimObj, e.m_fixtureA.GetBody()); // else {
|
|
74546
|
+
if (match) match(e.m_fixtureA.GetBody().zimObj, e.m_fixtureA.GetBody(), match.obj); // else {
|
|
74174
74547
|
match = zimContactEndList.at(e.m_fixtureA.GetBody());
|
|
74175
|
-
if (match) match(e.m_fixtureB.GetBody().zimObj, e.m_fixtureB.GetBody());
|
|
74548
|
+
if (match) match(e.m_fixtureB.GetBody().zimObj, e.m_fixtureB.GetBody(), match.obj);
|
|
74176
74549
|
}
|
|
74177
74550
|
obj.physics.world.SetContactListener(WW.zimContactListener);
|
|
74178
74551
|
}
|
|
74179
74552
|
obj.contact = function(f) {
|
|
74553
|
+
f.obj = obj;
|
|
74180
74554
|
if (!WW.zimContactListener) makeContact();
|
|
74181
74555
|
zimContactBeginList.add(obj.body, f);
|
|
74182
74556
|
return obj;
|
|
74183
74557
|
};
|
|
74184
74558
|
obj.noContact = function() {
|
|
74559
|
+
f.obj = obj;
|
|
74185
74560
|
zimContactBeginList.remove(obj.body);
|
|
74186
74561
|
return obj;
|
|
74187
74562
|
};
|
|
@@ -77554,6 +77929,9 @@ scramble(time, wait, num) - scramble the tile - this is done by default when mak
|
|
|
77554
77929
|
time and wait default to 0 and are the seconds to animate and wait to animate - also see ZIM TIME constant
|
|
77555
77930
|
num is how many times to scramble within the time - set to 3 for instance to scramble a small number of items
|
|
77556
77931
|
note that the tiles cannot be dragged from when called to when done scrambling
|
|
77932
|
+
note a Scrambler will not scramble() if already scrambling
|
|
77933
|
+
so scramble() chained on to new Scrambler() or run right away will be ignored unless the Scranbler scramble parameter is false
|
|
77934
|
+
Just use the time, wait and num parameters of the Scrambler instead
|
|
77557
77935
|
returns object for chaining
|
|
77558
77936
|
solve(time, wait, disable) - solve the tile - so arrange the tile in the start order
|
|
77559
77937
|
time and wait default to 0 and are the seconds to animate and wait to animate - also see ZIM TIME constant
|
|
@@ -77616,7 +77994,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
77616
77994
|
if (zot(shadowBlur)) shadowBlur=DS.shadowBlur!=null?DS.shadowBlur:5;
|
|
77617
77995
|
if (zot(swap)) swap=DS.swap!=null?DS.swap:false;
|
|
77618
77996
|
if (zot(swapLock)) swapLock=DS.swapLock!=null?DS.swapLock:false;
|
|
77619
|
-
if (swapLock) swap = true;
|
|
77997
|
+
if (swapLock) swap = true;
|
|
77620
77998
|
|
|
77621
77999
|
if (zot(tile)) tile = new zim.Tile(new zim.Rectangle(100,100,zim.series(zim.silver,zim.tin,zim.grey,zim.dark,zim.darker)),5,1,5);
|
|
77622
78000
|
tile.addTo(this);
|
|
@@ -77630,6 +78008,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
77630
78008
|
|
|
77631
78009
|
var frame = WW.zdf;
|
|
77632
78010
|
var scramblerID = zim.makeID(null,10);
|
|
78011
|
+
var scrambling = false;
|
|
77633
78012
|
|
|
77634
78013
|
var startX, startY;
|
|
77635
78014
|
var lastTile;
|
|
@@ -77860,18 +78239,23 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
77860
78239
|
|
|
77861
78240
|
this.inactive = false;
|
|
77862
78241
|
this.scramble = function(time, wait, num) {
|
|
77863
|
-
|
|
78242
|
+
if (scrambling) return that;
|
|
78243
|
+
scrambling = true;
|
|
78244
|
+
|
|
77864
78245
|
that.myDownCheck = false;
|
|
77865
78246
|
|
|
77866
78247
|
if (zot(wait)) wait = 0;
|
|
77867
78248
|
if (zot(time)) time = 0;
|
|
77868
78249
|
if (zot(num) || time==0) num = 1;
|
|
77869
78250
|
|
|
77870
|
-
offScrambler();
|
|
77871
|
-
|
|
77872
|
-
|
|
77873
|
-
|
|
77874
|
-
|
|
78251
|
+
offScrambler(time, wait);
|
|
78252
|
+
if (time==0) doScramble();
|
|
78253
|
+
else {
|
|
78254
|
+
zim.timeout(wait, function () {
|
|
78255
|
+
if (time>0) zim.interval(time/num, doScramble, num, true);
|
|
78256
|
+
else doScramble();
|
|
78257
|
+
});
|
|
78258
|
+
}
|
|
77875
78259
|
setTimeout(function () {
|
|
77876
78260
|
that.complete = false;
|
|
77877
78261
|
tile.loop(function (t) {
|
|
@@ -77901,8 +78285,9 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
77901
78285
|
}
|
|
77902
78286
|
// scramble location (not tile.remake()) to order
|
|
77903
78287
|
moveTiles(order, time/num);
|
|
77904
|
-
zim.timeout(time, function () {
|
|
78288
|
+
zim.timeout(time+.1, function () {
|
|
77905
78289
|
that.dispatchEvent("scrambled");
|
|
78290
|
+
scrambling = false;
|
|
77906
78291
|
})
|
|
77907
78292
|
}
|
|
77908
78293
|
return that;
|
|
@@ -77916,10 +78301,9 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
77916
78301
|
});
|
|
77917
78302
|
}
|
|
77918
78303
|
|
|
77919
|
-
function offScrambler() {
|
|
78304
|
+
function offScrambler(time, wait) {
|
|
77920
78305
|
if (that.upEvent) tile.off("pressup", that.upEvent);
|
|
77921
78306
|
if (that.moveEvent) tile.off("pressmove", that.moveEvent);
|
|
77922
|
-
|
|
77923
78307
|
tile.noDrag();
|
|
77924
78308
|
if (wait+time>0) {
|
|
77925
78309
|
that.noMouse();
|
|
@@ -77965,7 +78349,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
77965
78349
|
|
|
77966
78350
|
setTimeout(function () {
|
|
77967
78351
|
order = startOrder.slice();
|
|
77968
|
-
offScrambler();
|
|
78352
|
+
offScrambler(time, wait);
|
|
77969
78353
|
moveTiles(order, time, 0, disable);
|
|
77970
78354
|
}, timeType=="s"?wait*1000:wait);
|
|
77971
78355
|
|
|
@@ -85234,7 +85618,16 @@ zim.Frame = function(scaling, width, height, color, outerColor, ready, assets, p
|
|
|
85234
85618
|
function leftEvent(e) {
|
|
85235
85619
|
// e = e.nativeEvent;
|
|
85236
85620
|
that.leftMouseDown = e.buttons === undefined?e.which === 1:e.buttons === 1;
|
|
85237
|
-
if (oldLeft && !that.leftMouseDown)
|
|
85621
|
+
if (oldLeft && !that.leftMouseDown) {
|
|
85622
|
+
// adjusted ZIM 017 patch to accomodate mousemove trigger on fast apple drags
|
|
85623
|
+
if (e && e.type == "mouseup") {
|
|
85624
|
+
that.dispatchEvent("mouseupplus");
|
|
85625
|
+
} else {
|
|
85626
|
+
setTimeout(function() {
|
|
85627
|
+
that.dispatchEvent("mouseupplus");
|
|
85628
|
+
}, 30);
|
|
85629
|
+
}
|
|
85630
|
+
}
|
|
85238
85631
|
if (old2Left && !that.leftMouseDown) that.dispatchEvent("mouseupplusonly");
|
|
85239
85632
|
oldLeft = old2Left = that.leftMouseDown;
|
|
85240
85633
|
}
|
|
@@ -88070,6 +88463,42 @@ video.on("mousedown", ()=>{
|
|
|
88070
88463
|
});
|
|
88071
88464
|
END EXAMPLE
|
|
88072
88465
|
|
|
88466
|
+
EXAMPLE
|
|
88467
|
+
// getting a preview
|
|
88468
|
+
const video = new Vid("video.mp4")
|
|
88469
|
+
.scaleTo()
|
|
88470
|
+
.center()
|
|
88471
|
+
.vis(false);
|
|
88472
|
+
|
|
88473
|
+
new Pane("WELCOME").show(init);
|
|
88474
|
+
|
|
88475
|
+
function init() {
|
|
88476
|
+
video.play().pause().vis(true);
|
|
88477
|
+
// note, to play after this use video.pause(false); // not video.play()
|
|
88478
|
+
Ticker.always();
|
|
88479
|
+
}
|
|
88480
|
+
END EXAMPLE
|
|
88481
|
+
|
|
88482
|
+
EXAMPLE
|
|
88483
|
+
// getting a keyed out preview
|
|
88484
|
+
const video = new Vid("video.mp4")
|
|
88485
|
+
.scaleTo()
|
|
88486
|
+
.center()
|
|
88487
|
+
.vis(false);
|
|
88488
|
+
|
|
88489
|
+
new Pane("WELCOME").show(init);
|
|
88490
|
+
|
|
88491
|
+
function init() {
|
|
88492
|
+
video
|
|
88493
|
+
.keyOut("#01b03f", .25) // key out the green
|
|
88494
|
+
.play();
|
|
88495
|
+
timeout(.05, ()=>{
|
|
88496
|
+
video.pause().vis(true);
|
|
88497
|
+
});
|
|
88498
|
+
Ticker.always();
|
|
88499
|
+
}
|
|
88500
|
+
END EXAMPLE
|
|
88501
|
+
|
|
88073
88502
|
PARAMETERS
|
|
88074
88503
|
** supports DUO - parameters or single object with properties below
|
|
88075
88504
|
** supports VEE - parameters marked with ZIM VEE mean a zim Pick() object or Pick Literal can be passed
|
|
@@ -2419,8 +2419,8 @@ declare namespace zim {
|
|
|
2419
2419
|
static LabelInput(config: { text?: string | zimVee, size?: number, maxLength?: number, password?: string, selectionColor?: color, selectionAlpha?: number, blinkerColor?: color, blinkerSpeed?: number, font?: string, color?: color, rollColor?: color, shadowColor?: color, shadowBlur?: number, align?: string, valign?: string, lineWidth?: number, lineHeight?: number, bold?: boolean, italic?: boolean, variant?: boolean, backing?: DisplayObject, outlineColor?: color, outlineWidth?: number, backgroundColor?: color, backgroundBorderColor?: color, backgroundBorderWidth?: number, corner?: number | any[], backgroundDashed?: boolean, padding?: number, paddingH?: number, paddingV?: number, shiftH?: number, shiftV?: number, rollPersist?: boolean, labelWidth?: number, labelHeight?: number, style?: boolean, group?: string, inherit?: {} }): Container
|
|
2420
2420
|
}
|
|
2421
2421
|
export class List extends zim.Window implements zimComponent {
|
|
2422
|
-
constructor(config_or_width?: number, height?: number, list?: any[], viewNum?: number, vertical?: boolean, currentSelected?: boolean, align?: string, valign?: string, labelAlign?: string, labelValign?: string, labelIndent?: number, labelIndentH?: boolean, labelIndentV?: boolean, indent?: number, spacing?: number, backgroundColor?: color, rollBackgroundColor?: color, downBackgroundColor?: color, selectedBackgroundColor?: color, backdropColor?: color, color?: color, rollColor?: color, downColor?: color, selectedColor?: color, borderColor?: color, borderWidth?: number, padding?: number, corner?: number | any[], swipe?: boolean, scrollBarActive?: boolean, scrollBarDrag?: boolean, scrollBarColor?: color, scrollBarAlpha?: number, scrollBarFade?: boolean, scrollBarH?: boolean, scrollBarV?: boolean, scrollBarOverlay?: boolean, slide?: boolean, slideFactor?: number, slideSnap?: boolean, slideSnapDamp?: number, shadowColor?: color, shadowBlur?: number, paddingH?: number, paddingV?: number, scrollWheel?: boolean, damp?: number, titleBar?: string | Label, titleBarColor?: color, titleBarBackgroundColor?: color, titleBarHeight?: number, draggable?: boolean, boundary?: {} | Boundary, onTop?: boolean, close?: boolean, closeColor?: color, excludeCustomTap?: boolean, organizer?: Organizer, checkBox?: boolean, pulldown?: boolean, clone?: boolean, cancelCurrentDrag?: boolean, index?: number, resizeHandle?: boolean, resizeBoundary?: Boundary, resizeVisible?: boolean, drop?: boolean, dropTargets?: DisplayObject | [DisplayObject], dropSelf?: boolean, dropCopy?: boolean, dropColor?: color, dropThickness?: number, dropScrollSpeed?: number, dropReticleAlpha?: number, dropHitTest?: string, dropFull?: boolean, dropSnap?: boolean, dropEnd?: boolean, dropScale?: number, dropWidth?: number, dropHeight?: number, selectedIndex?: number, style?: boolean, group?: string, inherit?: {})
|
|
2423
|
-
constructor(config: { width?: number, height?: number, list?: any[], viewNum?: number, vertical?: boolean, currentSelected?: boolean, align?: string, valign?: string, labelAlign?: string, labelValign?: string, labelIndent?: number, labelIndentH?: boolean, labelIndentV?: boolean, indent?: number, spacing?: number, backgroundColor?: color, rollBackgroundColor?: color, downBackgroundColor?: color, selectedBackgroundColor?: color, backdropColor?: color, color?: color, rollColor?: color, downColor?: color, selectedColor?: color, borderColor?: color, borderWidth?: number, padding?: number, corner?: number | any[], swipe?: boolean, scrollBarActive?: boolean, scrollBarDrag?: boolean, scrollBarColor?: color, scrollBarAlpha?: number, scrollBarFade?: boolean, scrollBarH?: boolean, scrollBarV?: boolean, scrollBarOverlay?: boolean, slide?: boolean, slideFactor?: number, slideSnap?: boolean, slideSnapDamp?: number, shadowColor?: color, shadowBlur?: number, paddingH?: number, paddingV?: number, scrollWheel?: boolean, damp?: number, titleBar?: string | Label, titleBarColor?: color, titleBarBackgroundColor?: color, titleBarHeight?: number, draggable?: boolean, boundary?: {} | Boundary, onTop?: boolean, close?: boolean, closeColor?: color, excludeCustomTap?: boolean, organizer?: Organizer, checkBox?: boolean, pulldown?: boolean, clone?: boolean, cancelCurrentDrag?: boolean, index?: number, resizeHandle?: boolean, resizeBoundary?: Boundary, resizeVisible?: boolean, drop?: boolean, dropTargets?: DisplayObject | [DisplayObject], dropSelf?: boolean, dropCopy?: boolean, dropColor?: color, dropThickness?: number, dropScrollSpeed?: number, dropReticleAlpha?: number, dropHitTest?: string, dropFull?: boolean, dropSnap?: boolean, dropEnd?: boolean, dropScale?: number, dropWidth?: number, dropHeight?: number, selectedIndex?: number, style?: boolean, group?: string, inherit?: {} })
|
|
2422
|
+
constructor(config_or_width?: number, height?: number, list?: any[]|{}, viewNum?: number, vertical?: boolean, currentSelected?: boolean, align?: string, valign?: string, labelAlign?: string, labelValign?: string, labelIndent?: number, labelIndentH?: boolean, labelIndentV?: boolean, indent?: number, spacing?: number, backgroundColor?: color, rollBackgroundColor?: color, downBackgroundColor?: color, selectedBackgroundColor?: color, backdropColor?: color, color?: color, rollColor?: color, downColor?: color, selectedColor?: color, borderColor?: color, borderWidth?: number, padding?: number, corner?: number | any[], swipe?: boolean, scrollBarActive?: boolean, scrollBarDrag?: boolean, scrollBarColor?: color, scrollBarAlpha?: number, scrollBarFade?: boolean, scrollBarH?: boolean, scrollBarV?: boolean, scrollBarOverlay?: boolean, slide?: boolean, slideFactor?: number, slideSnap?: boolean, slideSnapDamp?: number, shadowColor?: color, shadowBlur?: number, paddingH?: number, paddingV?: number, scrollWheel?: boolean, damp?: number, titleBar?: string | Label, titleBarColor?: color, titleBarBackgroundColor?: color, titleBarHeight?: number, draggable?: boolean, boundary?: {} | Boundary, onTop?: boolean, close?: boolean, closeColor?: color, excludeCustomTap?: boolean, organizer?: Organizer, checkBox?: boolean, pulldown?: boolean, clone?: boolean, cancelCurrentDrag?: boolean, index?: number, resizeHandle?: boolean, resizeBoundary?: Boundary, resizeVisible?: boolean, drop?: boolean, dropTargets?: DisplayObject | [DisplayObject], dropSelf?: boolean, dropCopy?: boolean, dropColor?: color, dropThickness?: number, dropScrollSpeed?: number, dropReticleAlpha?: number, dropHitTest?: string, dropFull?: boolean, dropSnap?: boolean, dropEnd?: boolean, dropScale?: number, dropWidth?: number, dropHeight?: number, selectedIndex?: number, style?: boolean, group?: string, inherit?: {})
|
|
2423
|
+
constructor(config: { width?: number, height?: number, list?: any[]|{}, viewNum?: number, vertical?: boolean, currentSelected?: boolean, align?: string, valign?: string, labelAlign?: string, labelValign?: string, labelIndent?: number, labelIndentH?: boolean, labelIndentV?: boolean, indent?: number, spacing?: number, backgroundColor?: color, rollBackgroundColor?: color, downBackgroundColor?: color, selectedBackgroundColor?: color, backdropColor?: color, color?: color, rollColor?: color, downColor?: color, selectedColor?: color, borderColor?: color, borderWidth?: number, padding?: number, corner?: number | any[], swipe?: boolean, scrollBarActive?: boolean, scrollBarDrag?: boolean, scrollBarColor?: color, scrollBarAlpha?: number, scrollBarFade?: boolean, scrollBarH?: boolean, scrollBarV?: boolean, scrollBarOverlay?: boolean, slide?: boolean, slideFactor?: number, slideSnap?: boolean, slideSnapDamp?: number, shadowColor?: color, shadowBlur?: number, paddingH?: number, paddingV?: number, scrollWheel?: boolean, damp?: number, titleBar?: string | Label, titleBarColor?: color, titleBarBackgroundColor?: color, titleBarHeight?: number, draggable?: boolean, boundary?: {} | Boundary, onTop?: boolean, close?: boolean, closeColor?: color, excludeCustomTap?: boolean, organizer?: Organizer, checkBox?: boolean, pulldown?: boolean, clone?: boolean, cancelCurrentDrag?: boolean, index?: number, resizeHandle?: boolean, resizeBoundary?: Boundary, resizeVisible?: boolean, drop?: boolean, dropTargets?: DisplayObject | [DisplayObject], dropSelf?: boolean, dropCopy?: boolean, dropColor?: color, dropThickness?: number, dropScrollSpeed?: number, dropReticleAlpha?: number, dropHitTest?: string, dropFull?: boolean, dropSnap?: boolean, dropEnd?: boolean, dropScale?: number, dropWidth?: number, dropHeight?: number, selectedIndex?: number, style?: boolean, group?: string, inherit?: {} })
|
|
2424
2424
|
// ZIM Component Interface
|
|
2425
2425
|
// dispose():boolean // now added to Container, etc.
|
|
2426
2426
|
enabled: boolean
|
|
@@ -2452,7 +2452,7 @@ declare namespace zim {
|
|
|
2452
2452
|
readonly currentValue: string
|
|
2453
2453
|
readonly label: Label
|
|
2454
2454
|
readonly titleBarLabel: Label
|
|
2455
|
-
readonly list: any[]
|
|
2455
|
+
readonly list: any[]|{}
|
|
2456
2456
|
readonly items: any[]
|
|
2457
2457
|
readonly itemsText: string[]
|
|
2458
2458
|
readonly length: number
|
|
@@ -2470,8 +2470,8 @@ declare namespace zim {
|
|
|
2470
2470
|
scrollEnabled: boolean
|
|
2471
2471
|
}
|
|
2472
2472
|
export class Stepper extends Container implements zimComponent {
|
|
2473
|
-
constructor(config_or_list?: string[] | number[], width?: number, backgroundColor?: color, borderColor?: color, borderWidth?: number, label?: Label, color?: color, vertical?: boolean, arrows?: number, corner?: number | any[], shadowColor?: color, shadowBlur?: number,
|
|
2474
|
-
constructor(config: { list?: string[] | number[], width?: number, backgroundColor?: color, borderColor?: color, borderWidth?: number, label?: Label, color?: color, vertical?: boolean, arrows?: number, corner?: number | any[], shadowColor?: color, shadowBlur?: number,
|
|
2473
|
+
constructor(config_or_list?: string[] | number[], width?: number, backgroundColor?: color, borderColor?: color, borderWidth?: number, label?: Label, color?: color, vertical?: boolean, arrows?: number, corner?: number | any[], shadowColor?: color, shadowBlur?: number, continuous?: boolean, display?: boolean, press?: boolean, hold?: boolean, holdDelay?: number, holdSpeed?: number, draggable?: boolean, dragSensitivity?: number, dragRange?: number, stepperType?: string, min?: number, max?: number, step?: number, step2?: number, arrows2?: boolean, arrows2Scale?: number, keyEnabled?: boolean, keyArrows?: number, rightForward?: boolean, downForward?: boolean, index?: number, value?: string | number, arrowColor?: color, arrowScale?: number, selectedIndex?: number, currentValue?: string | number, style?: boolean, group?: string, inherit?: {})
|
|
2474
|
+
constructor(config: { list?: string[] | number[], width?: number, backgroundColor?: color, borderColor?: color, borderWidth?: number, label?: Label, color?: color, vertical?: boolean, arrows?: number, corner?: number | any[], shadowColor?: color, shadowBlur?: number, continuous?: boolean, display?: boolean, press?: boolean, hold?: boolean, holdDelay?: number, holdSpeed?: number, draggable?: boolean, dragSensitivity?: number, dragRange?: number, stepperType?: string, min?: number, max?: number, step?: number, step2?: number, arrows2?: boolean, arrows2Scale?: number, keyEnabled?: boolean, keyArrows?: number, rightForward?: boolean, downForward?: boolean, index?: number, value?: string | number, arrowColor?: color, arrowScale?: number, selectedIndex?: number, currentValue?: string | number, style?: boolean, group?: string, inherit?: {} })
|
|
2475
2475
|
// ZIM Component Interface
|
|
2476
2476
|
// dispose():boolean // now added to Container, etc.
|
|
2477
2477
|
enabled: boolean
|
|
@@ -2482,7 +2482,7 @@ declare namespace zim {
|
|
|
2482
2482
|
selectedIndex: number
|
|
2483
2483
|
value: string | number
|
|
2484
2484
|
currentValue: string | number
|
|
2485
|
-
|
|
2485
|
+
valueEvent: string | number
|
|
2486
2486
|
stepperArray: string[] | number[]
|
|
2487
2487
|
containerPrev: Container
|
|
2488
2488
|
containerNext: Container
|
|
@@ -2496,6 +2496,7 @@ declare namespace zim {
|
|
|
2496
2496
|
max: number
|
|
2497
2497
|
label: Label
|
|
2498
2498
|
textBox: Shape
|
|
2499
|
+
continuous: boolean
|
|
2499
2500
|
keyFocus: boolean
|
|
2500
2501
|
}
|
|
2501
2502
|
export class Slider extends Container implements zimComponent {
|