ZIM Cat
ZIM Cat takes care of anything left that still bothered the team - here are a few examples:
- A major change is that time is now in Seconds not Milliseconds. ZIM is for the people and people in general do not want to think in Milliseconds. We provide a TIME = "ms"; constant that can be set to change back to Milliseconds.
- ZIM Cat introduces "lazy loading" so images and sound can be loaded with just asset() and not passed into asset parameters of Frame or loadAssest(). It is still recommended that the assets parameter be used as the lazy loading just calls loadAssets for each asset loaded. So it is slightly more efficient using an array in the parameters. We also worked out several ways to defeat CORS errors - but these should be used sparingly. Image, sound and font loading have been added as categories in the Docs under the Frame module. Docs and Updates now have dark and light mode and feature code syntax coloring.
- Versioning was moved to a single numeric version of Cat as ZIM has become more stable and requires less sub version updates.
- Many new features have been added - please see formatted UPDATES at https://zimjs.com/updates.html
ZIM Cat 04 (Diamond) - added 10K - April 7, 2021
1. ZIM EASE - IMPROVEMENT
https://zimjs.com/ease https://zimjs.com/cat/easeexamples.html Customize the easing equation with sliders and pass results into ZIM animate() Looks like this: // inside a ZIM animate() - made with graph from link above ease:zimEase([1.746,0.4,-0.91,0.8]) // also added "snap", "ballistic" and "slowmo" eases // with In, Out and InOut settings - see examples link ease:"snapOut"2. ZAPPS TOOL
https://zimjs.com/zapps.html Made a tool to create and zip the files for a PWA (Progressive Web App) This looks like Distill, Wonder and AssetTool (which have been slightly modernized). This was quite a large undertaking and we hope it turned out well. The system takes the place of 70 steps to make mobile apps using GitHub, PhoneGapBuild, signing keys, etc. Added a PWA() class in ZIM that the tool will insert (or can be done manually) This is used to make a custom message when on mobile browser to add to mobile home screen (A2HS) This code will be inserted into zapps.html by the tool: frame.on("ready", function() { new PWA(runZapp); function runZapp() { // normal template... var stage = frame.stage; var stageW = frame.width; var stageH = frame.height; // your code } // end runZapp }); // end of ready The system creates the following files: manifest.json serviceworker.js libraries/ directory with local zim and createjs files icons/ directory with icons zapp.html with file calls and meta tags (and PWA call) readme.txt - with instructions to replace index with zapp.html code The code page has been updated to feature the tool (see Code Page updates)3. ZAPPS vs ZAP
We know that we already have a ZIM Zap tool down in the gold bars this is for sharing files and will remain as is. We will refer to the new Zapps tool in the plural. Zapps is what we would like to call projects made with ZIM You are welcome to call your projects Zapps too - or a Zapp (singular) It is Z for ZIM and apps for apps - but Zapps also sound really fast! And that is a great thing about ZIM - we can make apps fast! Zapps!4. SVG ASSETS
https://zimjs.com/cat/svg.html SVG is now automatically converted to a Bitmap when passed into the Frame assets parameter or frame.loadAssets() assets parameter. const frame = new Frame({assets:"pic.svg"}); frame.on("ready", ()=>{ asset("pic.svg").center(); // etc. // the actual SVG is stored in the svg property zog(asset("pic.svg").svg); // the SVGContainer has been adjusted to parse this properly new SVGContainer(asset("pic.svg")).center(); // will still work frame.stage.update(); }); Thanks carddealer for the prompting The SVGContainer is still considered experimental and may not accept all SVG But a while back, it was improved to handle arcs properly. Added width and height parameters to svgToBitmap() Added params parameter to svgToBitmap to pass object through to callback after bitmap param used internally by Frame to handle SVG images5. TIMECHECK
TIMECHECK now defaults to false. Set it to true if converting older code - to make sure that your times are good.6. MOBILE FPS
Default FPS for mobile has been changed to 60fps from 30fps now that most devices are more powerful this can be set back with Ticker.setFPS(30,60); for 30 on mobile and 60 on desktop.7. KIDS
https://zimjs.com/slate Added Phone and Portrait CheckBoxes to ZIM Kids - thanks Karel Rosseel for the idea8. KEYBOARD LAYOUTS - IMPROVEMENT
https://zimjs.com/cat/keyboard.html Added layout parameter (at end) with "arabic", "hebrew", "turkish" and "azerty" settings (or "querty" default). These change the data to show different keyboards. new Keyboard({label:label, layout:"arabic"}).show(); Thanks Hussein Ghaly (arabic), Racheli Golan (hebrew), Ferudun Vural (turkish) and Karel Rosseel (azerty). Also added an override mapping for lower to upper and upper to lower case letters to the data parameter data. Adjusted data to handle any number of rows (min 10) for custom layouts And added a "back" special key that is like "backspace" but only takes up one key size The "spacebar" now takes up whatever space is left so the bottom row is always at the max number of columns9. GRID
Added allowToggle, cache and numbers parameters before style parameter Added numbersX and numbersY properties to individually set visible false if desired These changes make the Grid ready to be used for charts10. GENERAL
Added dragPaused property to objects with drag() to pause or unpause dragging - IMPROVEMENT this keeps setting like boundary where noDrag() does not BREAK Added a corner parameter and property to Triangle after borderWidth and before center parameter new Triangle(500,500,500,red,black,5,[20,20,100]).center() A negative wait time can be provided to animations in the animate() series - IMPROVEMENT this will start an animation before the previous animation ends - thanks Ami Hanya for the excellent idea Added a toggle() method and toggled property to List when accordion is set this will toggle the outermost (first) accordion - good for opening and closing a pulldown - thanks Ofweird Top for the suggestion! Removed a test for touch to scroll page in tag mode if swiping on stage on allowDefault true -BREAK It was causing double mouse events - will see if we can figure out a way to do the page scroll - IMPROVEMENT Made Dial accept currentValue style - left it out previously Made Slider and Dial accept VEE for min, max, step and currentValue also set these so delayPick works for instance, when tiling List animateTo() has its timePerItem fixed = was switched the wrong way for s/ms Adjusted List to capture selectedIndex, selected when tabs are used Adjusted List to animateTo() an item if tabbing and the item is not in view (top left reg assumed) Tabs - added keyLoop parameter at end before style which defaults to true to wrap tabs when tab key reaches end or start made List set keyLoop to false so List does not go past its ends when the tab key is used. Made Layout accept DisplayObjects as region objects - for default values eg. new Layout(stage, [header, content, footer]) gets converted to new Layout(stage, [{object:header}, {object:content}, {object:footer}]) Made it so an object passed into Layout as a region will update its outline() if there is one Made debug() chainable in physics (and updateDebug(), removeDebug()) Made ColorPicker have a selectedColor parameter along with the existing selectedIndex parameter BREAK for the List accordion tree object, changed the arrow property to expander with three types: "plus", "arrow" or "none" - thanks Ofweird Top for the suggestion. Also adjusted list to not apply backgroundColor style for label (not item, but actual label) that messes up rollover and shade colors Fixed ZIM ISO example https://zimjs.com/iso/ to not have scaling problem with older game module. Added STYLE support for label and labelLeft for Toggle Added STYLE support for always for RadioButtons Made toggled for Toggle get and set.11. CODE PAGE
Updated Code template to include less comments. Reorganized the Code Page as follows: removed the last sections: organization, treats, createjs, principles, programming and added them to a darkpaper page - linked to in the Code Help section. Converted these to latest ZIM and ES6 as well. Shortened the template and removed the "minimal" template. Made more link go to the rest of the templates so removed the second template section. Added a FEATURES section with Mobile (Zapps), SHIM for Animate and Accessibility. This leaves the following sections: START, FEATURES, CDN, HELP, TOOLS and LIBRARIES Inserted a link bar to these in between each of the sections for easy navigation Took Badges out of HELP and added Medium and DevTO site in HELP.12. PATCHED
Fixed Pen so that it draws curves between each point rather than straight lines The curves were there but were curving through a midpoint between points. Well, this was making a straight line! We needed to start at the previous midpoint and curve through the last point to the next midpoint Thanks Ferudun Vural for pointing out that we still had straight lines when animated quickly. This is an excellent change to Pen when reducing the damping (closer to 1) and results in smoother lines, as was intended, when drawing at faster speeds. Adjusted labels in Slider and Dial to be properly in the labels container. Now slider.labels.cache() will work properly for instance (previously only the last label made would be cached) Fixed List to ignore items without labels - little bug in ZIM Cat 04 when we added setting backgroundColor to clear if no label. Fixed Window and List scroll with damping swipestop event was being overwritten by earlier scrollbar drag fixes. Added bindings and GET url to TO and FROM report in Base - to more easily debug And added bindings to report() along with existing data. Updated ZIM Base with a new ZIP that gets rid of a PHP warning - thanks Amy Szczepanowski for the report Updated ZIM NIO / Pizzazz 04 Paths https://zimjs.com/nio/paths.html to DIAMOND so TextArea selection works on Chrome Fixed up a warning message in animate() on path about startPercent and percent not supported with drag We were checking to warn if added but percent defaults to 100 so was warning all the time. Added margin parameter to end of chop() to let pictures be chopped with extra margins - used for jigsaw puzzle for instance Added a call2 parameter at the end tap() to call a function if a pressup but not a tap (or double tap) Fixed Button color and rollColor direct parameter values being overwritten by label color and rollColor styles Fixed up splitWords on Tips() after adjustment to Label parameters - thanks Ami Hanya for the report. Patched Lazy Loading sound, mouseplus and fullscreen - see below. Added fontListHeight and fontListViewNum to TextEditor - thanks Marva for the good idea. Adjusted animate() sequenceCall parameter to be the object animating. Thanks Yan Wenge. Added button roll colors being applied on mousedown even if rollover does not occur - as in on mobile. This allows the roll colors and icons to be applied as a mobile button is being pressed If the user moves off while pressing down then the normal colors and icons apply, etc. If the user taps then the color will go back to normal on mobile or stay as the roll color on non-mobile Thanks omarpta for the request - and I think some others in the past - but we missed the solution. Also changed the button rollover to not rollover if the mouse or press is already down outside the button then rolling over the button. These changes were not tested with all formats of the Button like wait, toggle, icons and backings but they call the same roll functions so should be good. Added a test to set canvas parent tag to position relative if no position is set. This makes Tag() and TextArea(), etc. align properly when canvas tag is scaled. Thanks Stefan Meyer for initial work on this - it turns out there was a more simple way to fix (found by accident!) CheckBox rectangle and border rectangle now have box and box2 properties - was background property but never was working ZIM chop has been updated to work without globals - we had left the namespace off loop, Bitmap and Tile. The patch on ZIM Button has been patched to that.stage.frame rather than frame which does not necessarily exist. Thanks Ashley Long for the report on these two issues. We fixed the Synth Tone stop() docs to show the proper releaseTime parameter And also fixed how stop() right on the tone to start works so it lets the sound fade in a little otherwise stop volume is default JS volume. The duration parameter was calling stop and had the same problem so that is patched - thanks Yanwenge for the report! Added pausedOnBlur parameter to Synth tone() to pause tone when window is reduced or goes to another tab - thanks Yanwenge for the request This defaults to false at the moment but in Cat 05 we will switch it to true Added paused(state) method to Synth tone() to mute and unmute Fixed MovieClip in Cat 03 and Cat 04 - there was a typo in that rather than this. Thanks Ferudun for the report. Fixed Emitter dispose() when Frame is disposed - thanks Ashley Long for the report. Adjusted List.slider to make using stepper work (typo in offset) and made it use the step provided Adjusted List.colorPicker to make ColorPicker start with selected color - swatch did but not the default ColorPicker Fixed ZIM Frame and CreateJS to scroll mobile canvas when allowDefault is true and yet avoid double events This has been ongoing work by Ferudun Vural and Dan Zen and hopefully is fixed now. Thanks Pan K for the reminder! Patched CreateJS 1.3.3 but also launched this as 1.3.4 to update the NPM with new version. A matching ZIM 11.4.2 on NPM has been provided. Added a line in Frame allowDefault to set the CreateJS __touch.preventDefault property - not in current NPM version... This allows allowDefault property to be set and allow scrolling the canvas on mobile Adjusted Frame allowDefault to test for non-tag mode when setting no scrollbars on allowDefault false The Box2D docs links have been updated in the Physics entry in the docs - thanks Haj Boutat! Added call3 and call4 callback functions to tap() these activate on single tap when dbl is true with call3 happening for any single tap and call4 happening on single tap only if the double tap fails For instance if you want to do something on single tap but something else on double tap on the same object then use obj.tap({dbl:true, call:doubleTapFunction, call4:singleTapFunction}) Thanks Xuntar for the use case suggestion - and the code addition for the Tap() to prevent double tap drag single tap call ;-) Added local properties for Label font, bold, etc. when being set with properties... so clone and duplicate are correct - thanks Marva (again!) Swapped the position of Pane and Panel in Docs so search on pane finds pane first and not panel. Fixed hitTestCircleRect to work with a circle that is scaled. Updated bounds of Label when labelWidth or labelHeight are set - thanks Vishwas for the report. Fixed List when noScale is true so the selectedIndexPlusPosition goes to right place (only with equal or close to equal custom list sizes) - thanks Ami Hanya for report13. FULL SCREEN
https://zimjs.com/tips.html#FULLSCREEN Added fullscreen() to ZIM Frame as well as an isFullscreen property and "fullscreenenter" and "fullscreenexit" events. Thanks Bart Libert for the idea! frame.fullscreen();14. LAZY LOADING SOUND
https://zimjs.com/docs.html?item=Sound Patched ZIM Cat 04 so sounds can be lazy loaded - without preloading in Frame or frame.loadAssets() assets parameter Still it is better to preload multiple files. Thanks Yanwenge and Joseph Diefenbach for the report and help on this. asset("sound.mp3").play(); // will play once loaded (remember to interact first)15. MOUSEUPPLUS
Added a "mouseupplus" event and a leftMouseDown property to Frame. The reason is that stagemouseup and pressup do not trigger when outside an iframe if the canvas is in an iframe So mouseupplus (with double p) dispatches if the mouse up has happened outside the iframe - but it triggers as the mouse comes back into the stage There is no way to capture the mouse up as it happens but we can check the mouse button as we come back into the stage. The CreateJS "mouseenter" and "mouseleave" do not capture properly with iframes either - so a simple mousemove is used by frame. This is not an issue with touch but only with mouseup on iframe ZIM drag() and animate() - path drag - have been adjusted to use the event to stop dragging from getting "stuck" on the mouse when pressup happened outside the iframe16. VIS
Added short chainable vis() method to set visibility circle.vis(false); // still will hitTest where alp(0) will not17. STANDARDIZED SCALE MODES
ZIM now has standardized scale modes and scale constants as follows: FIT: fits object within a bounds without changing aspect ratio FILL: fills bounds with object without changing aspect ratio FULL: sets object width and height to bounds most likely stretching object These can be used in ZIM Frame as the scaling mode Also scaleTo() and fit() use the same as well So to be clear, FIT or "fit" can be used, etc. Also, all old values still work for backwards compatibility For example in Frame(), "outside" can still be used instead of FILL and in scaleTo(), "biggest" can still be used instead of FILL18. SITE
Redesigned main ZIM Pages - News, Examples, About, Learn, Code to have section links above each section and work better on mobile. Updated Meta Tags examples https://zimjs.com/templates/meta.html Added FONT, CONSTANTS, SCALE, RESPONSIVE and FULLSCREEN to ZIM Tips19. CREATEJS GITHUB
updated ZIM CreateJS to 1.3.3 (Codename Diamond - 10 years!) but also made the following legacy changes to the CreateJS GitHub repository: Fixed Polystar last bevel or miter https://github.com/CreateJS/EaselJS/issues/1046 Added drawPolygon() and pg() graphics methods https://github.com/CreateJS/EaselJS/issues/1058 Adjusted MovieClip to not avoid extra processing if one frame https://github.com/CreateJS/EaselJS/issues/1048 Adjusted SoundJS XHR test locally as was giving errors for local sounds It still gives a warning for needing to interact before playing sounds We are not playing the sound but just testing So we respond with a warning that says sounds are ready to play. https://github.com/CreateJS/SoundJS/commit/5213ac5696142bcba216ef10bef3105e5be1d4ef Adjusted TweenJS to add a hook for change tween properties dynamically https://github.com/CreateJS/TweenJS/commit/6df2b9ce7e68d3d824cc490b67cab2bc3204810a NOT yet added to CreateJS repository - will test - but is in the ZIM 1.3.3 createjs: Fixed selecting on touch screen on Chrome issue with allowDefault false Thanks Ferudun for testing and thoughts. https://github.com/CreateJS/EaselJS/issues/997 * At the moment, this means dragging the canvas to scroll the page does not work * even with allowDefault true - it seemed to be one or the other * if we let the stage be dragged then an extra press event was triggered. UPDATE this has been patched to work now in CreateJS 1.3.3 and the new CreateJS 1.3.4 which is the exact same file, the version has been advanced for NPM. Thanks Ferudun Vural for the solution. Still not added to the CreateJS repository but feeling more confident it be will soon.20. BASE
ZIM Base has been updated to work properly in PHP 8 - thanks omarpta for the patches! A main one was we were using legacy format for split() with array then split string That needed to be swapped. A new ZIP is provided that also includes the sql to make the tables.21. UPDATED
Code Page, CDN, ZIM SHIM, NPM (ZIM 11.4.2 and CreateJS 1.3.4), TypeScript, Templates, Docs, Distill, Slack, Discord, Bubbling Videos To come: Patreon, Blog
ZIM Cat 03 - added 14K - January 17, 2021
1. STYLE - IMPROVEMENT
Direct Objects are now allowed in ZIM STYLE: STYLE = { Circle:{color:red} // all circles made from now on are red } Previously the Circle would have been organized under type: STYLE = { type:{ Circle:{color:red} // all circles made from now on are red } } Now, ZIM assumes that any style directly in STYLE that starts with a capital letter is a type. The type property can still be used as an organizer if desired as behind the scene, directly styled objects are moved to the STYLE type property anyway. So setting a style of the first example will be converted to the second example the next time any style is applied. Here is a second example: STYLE = { Button:{width:200}, // Button objects will be width 200 width:100 // all objects - except Button objects will have a width of 100 } The example above demonstrates that Direct Object styles still override general styles regardless of order Direct Objects also work with Style (the Style class - as opposed to the STYLE consant): Style.add({Label:{font:courier}}); The traditional way still works too: Style.addType("Label",{font:courier});2. EFFECTS
https://zimjs.com/cat/effects.html Added hue, saturation, brightness, contrast as DisplayObject properties. These are shortcuts to MultiEffect below. Added effect() and noEffect() methods to DisplayObjects. These are found in the METHODS by Movement, Tap, etc. They apply blur, glow, shadow, color, alpha and multi effects. Added updateEffects() to update effects if effects are changed (note the s). If the size of the object changes then use updateEffects(true) to change the cache size - thanks Vishwas for the find obj.noEffect(); // will remove all obj.noEffect("blur"); // removes blur effects obj.noEffect("blur", "color"]); // removes blur and color, etc. Added new Effect objects to Controls under Effects as follows: new BlurEffect(); // apply blur new GlowEffect(); // apply glow and knock out new ShadowEffect(); // apply drop shadows and knock out new ColorEffect(); // change colors new MultiEffect(); // combination of hue, saturation, brightness and contrast (use properties though) new AlphaEffect(); // apply alpha mask These Effects may have many parameters with ZIM DUO, VEE and OCT turned on These get passed in to the effect() method as follows: obj.effect(new ShadowEffect()); // or obj.effect([new BlurEffect(), new ColorEffect()]); // etc. Added effects property to DisplayObjects (note the s). effects will hold all of the effects on the object each in a property: obj.effects.blur.blurX = 20; zog(obj.effects.glow.quality); // etc. The effects can be animated (or wiggled) using the DOT properties quotes: tile.animate({ props:{"effects.blur.blurX":200}, time:2, rewind:true } The hue, saturation, brightness and contrast can be animated like normal: tile.animate({brightness:50}, 2); // animate brightness to 50 in 2 seconds animate() will run the updateEffect() - which can be expensive performance-wise Remember, the hue, saturation, brightness and contrast are effects as well. ZIM animate() uses different versions (hueBatch, saturationBatch, etc.) of these properties so the effects can be batched. The effects wrap the CreateJS filter property and cache/updateCache system These also include DropShadow and Glow effects from https://github.com/u-kudox/Filters_for_EaselJS and then updated for CreateJS 1.0 at https://github.com/sky0014/Filters_for_EaselJS With their docs at https://kudox.jp/reference/filters_for_easeljs/ - thanks. The rest of the Effects are built in to CreateJS with many thanks there too. CreateJS has a way to bring in Shaders. If anyone is interested in providing examples that would be great.3. ARROW
https://zimjs.com/survey - and please, take the survey for real! Added PagesArrow to controls module. These work with Pages objects to go to the previous and next page. Adjusted Pages go() to accept a speed parameter rather than a ms parameter - as time is now in seconds. Added arrowDisableColor parameter and property to Pages defaulting to clear to set the color of the disabled PagesArrow objects. Added arrows property to Pages to hold reference to created PagesArrow buttons.4. SLIDER AND DIAL TICK LABELS - IMPROVEMENT
https://zimjs.com/cat/layout.html Added Slider and Dial Tick labels if true, will put values on semi-ticks (or ticks if no semi-ticks)5. LAYOUT - IMPROVEMENT
https://zimjs.com/cat/layout.html Added a "Region" value for a Container to be used in ZIM Layout objects. If the object in a region is given a type="Region" then it will have its bounds set to the region size. This allows for another Layout to be nested within a region and scale to the inner region. For example: var content = new Container(500,500); content.type = "Region"; // this now will have its bounds set to the region size. If the object is a Container (usual choice) then it must be given a starting width and height which will be reset to the region size and resized to continue to match the region size. Thanks Zeke Chan for the prompting. Added marginMinLeft and marginMinTop Layout region properties. BREAK Added lastMarginMin parameter to Layout() just after lastMargin and before backgroundColor. Added AUTO ("auto") constant and option for margins. AUTO allows margins to push to get as much room as possible. If multiple margins are AUTO they share the percentage left over. BREAK Changed regionShape parameter to a showRegions boolean - so ZIM auto makes the shape. BREAK Changed dispose() to actually dispose Layout - this removes backgroundColor and STOPS resize! This is in place to be able to swap Layout objects on orientation change See the docs for LayoutManager and Layout dispose() Adjusted LayoutManager to extend Manager and tidied up Manager code to handle method parameters for all objects (leave parameter empty), one object or an array of objects For instance resize() resizes all, resize(a) resizes a, resize([a,b]) resizes a and b Removed enable and disable in LayoutManager - use add() and remove() See the last pair of Layout objects in https://zimjs.com/cat/layout.html IMPROVEMENT for swapping HORIZONTAL and VERTICAL Layout objects (cool!)6. SURVEY
https://zimjs.com/survey/index.html?id=updates Created a survey on the Canvas with ZIM. If you are reading this and have not alread, please take the survey! Also have a look at ZIM Bind and ZIM Base working in harmony. The very minimal PHP code is under the ZIM code for reference. Thanks for your thoughts. NOTE the ZIM ZOOM date of January 20, 2021 3PM Eastern Central See Slack https://zimjs.com/zoom for the details7. DOCS
https://zimjs.com/docs.html https://zimjs.com/updates.html Added light mode for docs and updates that can be toggled with dark mode. See the Sun and Moon toggle in the bar at top right next to TOP and SEARCH. We have also added code syntax coloring for both light and dark. Thanks Yalon and others for the prompting. The search functionality has been on people's minds as well. We added back the browser search functionality to accommodate (CTRL F). We have made the / key go the the ZIM search - thanks Karel Rosseel for the tip. Currently, the top search finds any zim.class / zim.function It does not find properties, parameters or instruction. A reminder that there is a full TEXT version of the Docs. This is available at the top of the docs or here: https://zimjs.com/docs_text.php We have also considered alphabetical order and have decided that for now, items will be listed roughly by importance and in some cases by themes - and of course many lists are in parameter order.8. MAP
https://zimjs.com/map A site map has been added to the Gold Bars - thanks various folks for the request. And the Gold Bars are now in the following order: INTRO MAP LAB TIPS SKOOL KIDS VIDS ZAP With TEN and CAT removed to make room for MAP and KIDS and VIDS swapped9. ZOOM
https://zimjs.com/zoom Added ZIM ZOOM page for future dates and themes of ZIM ZOOM meets. The first on the list is Wednesday, January 20 - see page for details. Themes and days of the month will vary from month to month. We recommend that you show some ZIM work as your backdrop! Looking forward to seeing more of you out to these - don't be shy!10. DISCORD
https://zimjs.com/discord Added ZIM Discord server with the help of Unrid and Kasper our Adminions! Lots of fun bot commands and hangouts so drop on by if on Discord. We hope that this will help grow a youth community (not that you guys are old). ZIM is for everyone - woot!11. MOBILE
https://zimjs.com/mobile.html Added an info page on mobile with features for mobile: PWA examples for Progressive Web Apps - and Trusted Web Activities and Capacitor information for making Native Apps from PWAs. Added these link in TOOLS on the Code Page above MVC and NPM and to the Dev site.12. MEMORY - IMPROVEMENT
All DisplayObjects (running methods like animate(), transform(), drag(), etc.) and all Controls (MotionController, Dynamo, Sprite, Parallax, Pen, etc.) have dispose() methods where ZIM removes listeners and internal references. // If we have an object: const obj = new Blob().center(); // it can be properly disposed as follows: obj.dispose(); obj = null; // note the setting to null - ZIM cannot delete your references to an object. // a control may leave the object it is controlling on display for you to dispose. Memory in ZIM has been tested using Google Memory Heap Snapshots - thanks Disco Drama for his guidance. Memory leaks happen when objects are left in existence and not garbage collected when expected. Objects will not be garbage collected unless all references to them are deleted. A primary cause is when event listeners are not removed. ZIM dispose() now removes all listeners on the object and disposes its contents recursively. This means you should be able to dispose a Container of objects just by disposing the Container. A global dispose function is being run that disposes the following: if (zim.KEYFOCUS == obj) zim.KEYFOCUS = null; if (obj.draggable) obj.noDrag(); if (obj.zimTweens) obj.stopAnimate(); if (obj.zimWire) obj.noWire(); if (obj.zimWired) obj.noWired(); if (obj.zimClickHoldDownEvent) obj.noHold(); if (obj.transformControls) obj.transformControls.dispose(); if (obj.zimClickDownEvent) obj.zimClickDownEvent = null; if (obj.zimClickUpEvent) obj.zimClickUpEvent = null; if (obj.physics) obj.removePhysics(); if (obj.name && zim.zimObjectIDs[obj.name] == obj) delete zim.zimObjectIDs[obj.name]; Here are notes from the Memory Testing which took several weeks. DISPLAYOBJECTS Squiggle and Blob had local stage which meant multiple calls to the points property were not removing shapes - this and SelectionSets are now properly cleared. Adjusted stage event to clear as it was being added more than once on points call Adjusted hold() to remove stage event and clear from memory Bitmap is now disposed when using asset("image.png").dispose(); Use clone() to keep an image around for later otherwise will make from lazy load List - removed a bunch or references to tabs Tabs - button, label references Layer - removed stagemouseup event Stepper - removed references to Label, Rectangle, Triangles Selector - added dispose to container TextEditor - removed references to all parts so they dispose - color, font, size, etc. components TextArea - removed DOM events on TextArea tag so dispose clears from memory KeyBoard - changed .name properties to .na properties to not conflict with .name/nam() global properties Organizer - extended Tabs but had its own that.buttons which overrode the Tabs buttons so it could not be disposed (3 hour bug) Connectors - removed keydown event so can dispose properly Marquee - removed in timeout for page refresh and disposed pages to properly dispose Loader - removed various events on html tag so disposed properly Book - added dispose to container Added prototype dispose to Window, Panel, Tabs, Buttons so Classes extending these can override dispose() (five hour bug) Automatically call dispose on tranformControls if object is being transformed and disposed METHODS animate() - Animated objects were being held in memory even if disposed. This has been adjusted. and needed to remove requestAnimationFrame for dynamic animations. tap() - Objects with tap() were being held in memory even when disposed. This has been adjusted. wire() and wired() - DisplayObject dispose() methods now check for wire or wired and removes the connection - freeing the object from memory. also checked drag(), gesture(), transform(), with no problems CONTROLS Pages - needed to dispose Swipe when Pages is disposed in addition to already removing swipe event Parallax - removed stage event so objects are disposed - need to dispose objects still Emitter - need to set that.currentParticle to null Generator - changed pauseSpaceEvent to pauseSpacebarEvent to properly dispose Pen - removed nib stage events and consolidated keydown and keyup events for proper dispose Synth and Physics have things left in memory due to other systems - synth is minimal, physics is being considered DISPOSE NOTES: disposeAllChildren() was added in Cat 02 to dispose container children but not the container (like dispose() would do) Also - warning, zog() or console.log() on an object will keep it in memory for console consider setting zns=false before starting ZIM on final apps - this turns off all zog messages - or just remove logging ZIM dispose() will remove all your event listeners on the object but not your references to the objects // for instance, if you reference an object obj in a keydown listener: const keyEvent = frame.on("keydown", ()=>{obj.center();}); // then you need to remove the listener for proper garbage collection: frame.off("keydown", keyEvent); MEMORY TESTING: Not all apps need to be tested unless you expect them to run for a long period or they seem to be bogging. To test memory of your objects in Chrome use F12 for developer tools and use the Memory tab. Run the app then take a Heap Snapshot - use the docs version of ZIM and sort to see ZIM objects. If you have issues, please contact us in https://zimjs.com/slack and we can discuss solutions.13. DISPLAYBASE
Added an internal displayBase() function to make common properties for the basic DisplayObjects: Container, Shape, Bitmap, Sprite, MovieClip. Moved the following common properties that were assigned in zimify() into displayBase() width, height, widthOnly, heightOnly, level, depth, blendMode Added these properties that were in each basic DisplayObject: draggable, name Added these new effect properties: hue, saturation, brightness, contrast (and Batch versions) These all now are inherited by the ZIM shapes and components.14. GENERAL IMPROVEMENT
Added corner property (always have had parameter) to Rectangle - thanks Nikola Jankovic for request Added radius property (always have had parameter) to arc - thanks Nick Karasek (will try and get multi-line text next release) See https://zimjs.com/cat/layout.html part 2 and 3 for examples of above. Replaced horizontal parameter in Swiper to swiperType BREAK Added setTimeout checks for Tag, TextArea and Loader to make sure adding does not happen after removed this was causing these to be left behind if ZIM Pages were going faster than 50 ms Added dispose to override in HotSpot and HotSpots - it was set wrongly to clone override. Fixed typo in running masterFilter in Bind - had written masterFunction at one point rather than masterFilter Added style:style to Labels of RadioButtons and Checkbox so style can be turned off with style:false on main class Fixed bug in Swiper when swipeOn is the stage and not another object Fixed bug in Book dispose() - dispose versus disposing typo Adjusted Emitter so disposes without error when fade and shrink are false Fixed clone of exact on Button - had typo with initial parameters Fixed startHead and endHead being properly defaulting to null not "null" Fixed length property of ZIM line - power code had a typo - thanks Stefan Meyer for these two finds. Fixed STYLE with pos() and providing container - was missing that property15. PATCHED
See also many patches made to ZIM Cat 02 (these may be added after GitHub and NPM versions of Cat 02) Fixed height variable in Dial - needed declaration when adding useLabels. 1/18/21 Changed Layout dispose() to actually dispose and removed LayoutManager enabled and disabled - see Layout above. 1/19/21 Adjusted Squiggle and Blob so they do not dispose events when changing points - logic issue when updating memory - thanks Stefan Meyer for find. 1/19/21 Added animate() waitedCall and waitedParams to sequence - these were not being passed through - thanks Yan Wenge for the report.1/21/21 Fixed Label so backing goes beneath Label outline - we had set this to work only with backgroundColor... 1/21/21 BREAK Turned back on letterSpacings when Label has a backgroundColor - needed some way to handle kerning (still turned off for letterSpacing) 1/21/21 Adjusted Blob and Squiggle clone so like Shape, they clone the bounds. These two do not always have perfect bounds - they take the default bounds of the number of points. Thanks Karel Rosseel for the report. The approximateBounds() method can be used - but was being ignored when cloned - for instance in an Emitter or Tile and so clone needs to clone the new bounds. Adjusted hitTestGrid() to properly take into account spaces - this came from solving a bug in the Scrambler with spaces in a grid. IMPROVEMENT Added a new type to hitTestGrid() called "open". This allows spacing to be added and grid to return values even when point is in spacing area A grid needs to have the spacing added to the number of columns and divided to get col or row sizes which had been done But the position needs to have half the spacing NOT half the col or row size - so this was adjusted. The new setting has been applied to Tile for getting current tile under mouse and Scrambler - which had a slight error of margin bug - now okay. If you have a Scrambler in a grid with spacing then we recommend updating to Cat 03. Fixed Sprite run() with wait start, and loopWait with on return from blurred window - thanks Netanela for the report. The actual CreateJS Sprite needed to be explicitely paused in these cases otherwise it would run on its own. Changed noDrag() on draggable Panel to be noDrag(false) to keep cursors on objects in panels - no need to recursively turn drags off Added collapse and collapsed parameters to end of Panel to allow double clicking on bar to hide and show panel content - leaving bar visible Added collapsed getter setter property to Panel BREAK adjusted tap() to be time in seconds by default rather than ms and to default to 8 seconds for a tap. Updated AlphaEffect to have proper examples - also made mask work with Bitmap directly (rather than Bitmap.image) and work with any ZIM DisplayObject - so GradientColor and RadialColor will work for example - caches mask and uses its cacheCanvas as a mask Added an AlphaEffect to the https://zimjs.com/cat/effects.html example - it is the striped Pragma for a selected effect. Added effects property to docs for Container, Shape, Bitmap, Sprite, MoviClip NO TO BELOW - reverted because the object may be added to a container before the container gets added to the stage - back to polling for added() xx Adjusted the added() method to use the CreateJS "added" event and then check for the stage rather than polling xx The CreateJS "added" event only triggers when added to a container - not necessarily the stage. Adjusted animate() function (not method) for when animating a non-zim object the rewind was expecting a style property for css... this is fixed to test for one first Fixed color property on LabelLetters - was refering to itself rather than this._color. Thanks Joseph Diefenbach for the find. Adjusted Container to accept a ZIM Boundary object (or CreateJS Rectangle) as a single parameter to specify the bounds - thanks Joseph Diefenbach for the suggestion. Adjusted Bitmap clone() to clone width, height, x, y settings if provided in original Updated ZIM SHIM to Cat 03 and fixed name and nam() to not overwrite MovieClip instance names when zimified - thanks Ami Hanya for the report. Fixed ZIM Keyboard so special characters show up on hold - also added these to data parameter as an object literal - thanks Hussein Ghaly for the suggestion Fixed sequenceCall to call every sequence - got lost in ZIM 10.7.0 update - thanks James Barrett for the report and Joseph Diefenbach for the aid. Fixed Window enable setter to properly record the _enable private var so the getter responds properly Added the enabled property to selector - it was missing. Added a stopAnimate to selector so later selected values do not get overwritten by previous animation ZIM timeout and interval now support ZIM DUO parameters or config object - thanks James Barrett for the request Fixed docs for items such as https://zimjs.com/docs.html?items=Stage,tap a scope error happened when moving scripts from bottom to top of docs in a DOMContentLoaded event function Patched ZIM Ajax to use uriEncodeComponent() instead of uriEncode() and used this to handle JSON data in Ajax call to solve & problem in data Tested in a number of ZIM Bind() and survey examples and seems good - but check any Ajax Cat 03 apps. Removed delete method from Pen as was conflicting with Distill minification - thanks Xuntar for the report left the method in Cat 03 zim.js file to not break existing code - but will be gone in Cat 04 Use instead the deleteSegment() method Fixed animate() from property when in series - thanks Ami Hanya for the find - 2/23/21 Had moved relative animation check to after wait so loopPick would work and from settings were moved to after relative so this meant relative for later series were not working16. ZIM BASE IMPROVEMENT
Added $base->simplify(couple) method to turn ZIM Bind nested data into an assocative array for inserting to database previously and still there is a couple parameter in ZIM Bind that will couple the data: // eg. {"circle":{"x":"10", "y":"20"},"count":{"currentValue":"0"}} // is: {"circle_x":"10", "circle_y":"20", "count_currentValue":"0"} This can now be handled on the server without using the couple parameter by using $vars = $base->simplify(true); Then the vars will be called the couple names. BUT - if storing bind data for a traditional form then usually each bindID will only store one property: // for example: {"name":{"text":"Dan Zen"},"occupation":{"text":"Inventor"}} // with coupled this would be annoying: [name_text=>"Dan Zen", occupation_text=>"Inventor"] // without coupled it is better so use $vars = $base->simplify(); [name=>"Dan Zen", occupation=>"Inventor"] // The resulting associative array can be merged with other desired data and passed to $bind->insert() etc. $pairs = array(uid=>$master, date=>"NOW()"); $pairs = array_merge($pairs, $data->simplify()); $result = $base->insert("zim_survey", $pairs);17. 2020 REPORT
https://zimjs.com/2020 Added two animated charts / graphs showing ZIM growth over the year. Thank you all who have helped share ZIM - please continue to do so!18. SITE
Added eChalk examples and Shake and Spill example to ZIM Learn Apps front-page banner section - thanks Iestyn Jones and Laurie Bloomfield Added a couple interactive logos - thanks @Rigun K.G. and @Amy Szczepanowski for the Logo examples. Added gen art examples and a few puzzles and a bunch of holiday card examples to the ZIM Banner pages. Added 2020 radial chart and animated graph to Data Vis front-page banner section Added Discord and Isometric Board to ZIM Code page Added ZIM ZOOM page at https://zimjs.com/zoom19. EVENTS
https://zimjs.com/cat/events.html Added dbl and dblTime parameters to tap() so can handle double click better on mobile BREAK these were changed from double and doubleTime due to minification issues with the keyword double! Added ZIM DUO to tap as well... The "dblclick" event does not seem to work on mobile - thanks Vishwas and Joseph Diefenbach for the prompting The Tap was adjusted to be able to handle both a single tap and a dblTap on the same object. Finally brought back the "pressdown" event that is the same as "mousedown" but matches the other press events So we have pressdown, pressmove and pressup - thanks Jeff Peck for the solution of putting the events on the stage and have them bubble20. ZAP
ZIM ZAP is fixed so we can edit zaps with single quotes in them ' Needed to add: if ($code) $code = mysqli_real_escape_string($mysqli, $code);21. CREATEJS
Updated loading sound to fix warnings and errors in CreateJS 1.3.2 Was getting error loading WebAudioPluginTest.fail localling CreateJS knew there was supposed to be an error to test for XHR The try catch just stopped working So changed the test to if local file then do not use XHR. On the server, we are getting a warning about starting a sound before interaction CreateJS is setting up an audioContext - so all is good Rather than adjust that as it is complex, we added a second warning saying AudioContext is ready22. UPDATED
Home page Cat Mini Site, Bubbling Videos, site footers, CDN, Code Page, TypeScript, NPM (11.3.0) Slack, Discord, GitHub, Templates, Distill, Patreon, Blog
ZIM Cat 02 - added 12K - November 18, 2020
1. BOOK
https://zimjs.com/cat/book.html https://zimjs.com/darklo Creates a book with pages that flip like a real book. The pages are passed in as an array and can include interactivity. The user can flip pages by dragging the pages or using the arrows. The pages can be turned with code using nextPage() and prevPage() methods and specific pages can be turned to with the gotoPage() method. Book is different than ZIM Pages which have transitions and do not "flip".2. LABELLETTERS
LabelLetters now accepts Tags IMPROVEMENT https://zimjs.com/cat/htmltext.html Made LabelLetters accept html-like tags as follows: bold - or bold italic - or italic underline - can use this with to make a classic underlined link link font note: DO NOT use QUOTES except for single quote with colors if want HTML blue for instance rather than ZIM blue note: setting groupStyle will make letter from scratch as opposed to building on the submitted label styles Thanks Ami Hanya for the prompting! BREAK - added to and adjusted the LabelLetters parameters: label, align, valign, letterSpacing, letterSpacings, lineSpacing, lineSpacings, lineHeight, lineAlign, lineValign, cache, style, group, inherit spacing is now letterSpacing and we have added lineSpacing and lineSpacings The letterSpacing and lineSpacing are the default spacings. The letterSpacings and lineSpacings are arrays that can specify certain spacings to override the default spacings. align and valign are for the letters registration points - good for controlling animation lineAlign and lineValign are alignments of the lines horizontally and of the letters in the lines vertically. letterSpacing is turned off when Label backgroundColor is on - so use letterSpacings if needed or on the label use backing. this is so the letters stay together when highlighted for links or background colors in the pseudo HTML.3. CHOP
https://zimjs.com/cat/scrambler.html https://zimjs.com/explore/chop.html The chop() functin breaks a DisplayObject into a Tile of Bitmaps - great for the Scrambler4. TOALPHA
Change a color to have an alpha // Short cut to convertColor() but as method of a string blue.toAlpha(.5) // Similar to the toColor(), lighten() and darken() methods blue.toColor(red, .2) blue.lighten(.3) blue.darken(.3)5. GENERATOR UPDATES
https://codepen.io/zimjs/pen/XWjrmoQ Added a noise() function to the Generator that does ZIM Noise simplex methods automatically choosing 1D-4D. This returns a number from 0 to 1 (matching Processing/P5js) as opposed to -1 to 1. Added a seed parameter to Generator to set the Noise seed if desired. Added resetup(), redraw() and restamp() methods to Generator To call the setup, and start the draw and stamp functions again This is very cool with stamp as we can animate through stamped pictures to basically animate the Generator -- beyond just doing the draw animation - see https://codepen.io/zimjs/pen/XWjrmoQ Added clear and reset methods to Generator The clear() method will clear the image but keep the transforms The reset() method will reset the transforms, set to startX and startY and reset color, strokeColor and strokeWidth These can also be called through resetup(), redraw() and restamp()6. GENERAL
Added ZIM multi-asset format for Frame asset loading (both in Frame and loadAssets()) - thanks Netanela This makes it easier to handle multiple paths - for example: [{assets:["one.png", "two.png"], path:"images/"}, {assets:["big.mp3", "oof.mp3"], path:"sounds/"}] Further properties are loadTimeout, maxNum, and noCORSonImage Updated Frame and loadAssets() maxConnections to 10 - thanks Disco for the discovery (and thanks CreateJS) Adjusted ZIM Page to not apply styles to inside Rectangle as styles already applied to Page parameters and take on backing of stage.height and stage.width by default rather than screen height an screen width Adjusted hitTests to only show up once each in Distill Removed all references to pressdown - failed attempt to match pressmove - but e.target is wrong so did not work. Added expand, expandVertical, expandBar, expandBarVertical parameters to end of Slider Adjusted Sprite to work with asset without path provided - also need to put proper path (ie. assets/sheet.png) in json file Fixed lighten(), darken(), toColor() to work with "red", etc. - methods were on a String object so it needed to be converted with String(color) - weird Adjusted TextArea readOnly, spellCheck and placeholder to accept styles and be set to true or false properly - thanks Cajoek for the mention IMPROVEMENT Reorganized Frame assets to be global so multiple frames hold same assets object and do not overwrite one another Made Stepper default to "list" intead of "number" if array is passed in to list parameter. Added percent and percentClose properties to Circle - thanks Netanela for the suggestion - very cool to see percent animate.7. PATCHED
Added cache as a STYLE function - thanks Disco Drama for the inspiration STYLE = {cache:true} // will cache all DisplayObjects - or cache individual types, etc. Fixed Dial press to jump to value when dial rotated Remembered to update the version... this is new to ZIM Cat... takes some getting used to. Fixed ZIM Multi-asset Object - bug in multiple loads now fixed - thanks Netanela Also adjusted Multi-asset Object so if filename is the same as a previous filename this file gets the path added to its id. Adjusted alp() to set any object with a tag property so the opacity of the tag is set This means a textArea.alp(.5) will actually set the alpha of the HMTL tag as well This does not work with textArea.alpha = .5 - only with the .alp() - Thanks Cajoek for prompting. Updated ZIM Sprite to work with multiple spritesheets for one Sprite - Thanks Netanela for the suggestion. Added factor and offset to ZIM List.slider static method Added container scaling adjust in resize() for Tag() and Loader() to match TextArea - thanks Stefan for the find. Fixed LabelLetters dispose() method - thanks Cajoek for the find! Added new line \n and \r support to LabelLetters - was there for
Adjusted TextEditor to display none the HTML textarea when colorPicker is activated Added "color" event to TextEditor that dispatches when colorPicker is opened Added closeColorPicker() method to TextEditor to close colorPicker - and add HTML textarea back Changed color property of TextEditor to swatch to reference the Rectangle - was not even hooked up and color is the wrong name Note that the color parameter is the color of the text which is completely independent from the swatch and the ColorPicker (these handle the label - not the TextArea) Fixed dynamic animation with percentComplete in ZIM Cat - adjusted to handle time in seconds - thanks Maziear Mou for the report. Made transform() not try and transform scaleX or scaleY of object with no scaleX or scaleY - like a line which has not scale Y. Maziear Mou for the report. Adjusted various DISTILL check conditionals to not start as true - not needed - made consistent and added animateCheck too. IMPROVEMENT fixed object.rate for animate series - now applies rate to all tweens. Added test to name in clone so does not make a name of undefined and keep reference to object! Changed the check on the TextEditor to a Shape - thanks James for reporting that Apple iOS can't support a checkmark that everywhere else supports Also added a frame parameter to TextEditor for locating TextEditor on different frame - helps with ColorPicker and TextArea - thanks James Barrett for the find Adjusted Distill to work again with ZIM Shapes - the CustomShape was in the wrong order - thanks Chris S for the report Patched borderWidth of ZIM shapes so when set to 0 it can be set back to a thickness - glitch in CustomShape code - thanks Maziear Mou for the find IMPROVEMENT Added multiple and accept parameters to Loader (thanks Ami Hanya for the suggestion) multiple - (default true) set to false to let user only upload one file rather than multiple files (with shift or ctrl) accept - (default null) set to extension / MIME-type to limit types of files the upload dialog will suggest here are some examples: "image/*" "image/jpeg, image/png" ".png, .jpeg, .jpg, .gif" "image/jpeg, .jpeg, .jpg" ".txt, .json, application/json" Adjusted Button toggle parameter to accept a Boolean true (as well as a String) to toggle the various colors, etc. without changing the Label text - thanks Cajoek for idea Adjusted Tag, TextArea and Loader to do a parentNode test when disposing to make sure HTML tag is there - thanks Frank Los for the report Added changeFrame(frame) method to ZIM Book if the book needs to change frames - thanks James for the suggestion IMPROVEMENT updated Sprite so that pauseOnBlur activates the sprite again when the user goes to another tab and then tabs back. Thanks Chris S for the report See the section on LAYOUT for new layout "Region" feature IMPROVEMENT animate now adds a tweenState object to its target. This has properties for all the object ids and a property called all. These keep track of what is animating for the object. The setBlurDectect() now uses this to pause and start individual animations rather than all or none. Previously, the latest paused state was recorded and reused - this could lead to paused ids animating on return to focus. Adjusted animate to stop sprite if sprite was stopped and pauseAnimate(false) is set For Sprites with other animate() calls this would cause the sprite to run quickly through its frames. Fixed animate() with from and relative amount such as "100" Changed draggable parameter of pen to move. this is the parameter to say whether the lines can be moved afterwards BREAK although, not really - the draggable parameter was not working since it was conflicting with the draggable property added to all DisplayObjects. Changed distill() to filter out duplicates - we were keeping track of how many times certain features were used - but recording the feature once now is fine. Fixed bug in loading noCORSonImage with multiple images - thanks Ami Hanya and Disco Drama for the find Made BitmapColor() work with a ZIM Image object - an image loaded without preloading - still need to wait for image to complete before using as BitmapColor var image = asset("pic.jpg"); // not preloading image.on("complete", function() { new Triangle(200,200,200,new BitmapColor(image)).center(); stage.update(); }); // thanks Karel Rosseel for prompting Fixed repetition parameter typo in BitmapColor - thanks Karel Rosseel for the find Added a matrix parameter to the CreateJS bitmap() method of the Shape command So that the matrix parameter of BitmapColor now works. Applied the change to CreateJS 1.3.2 and to CreateJS on their GitHub Fixed align and valign of Button when using text property - thanks Nick Karasek for the find Changed the length property of series to num as series is a function and the length is the JavaScript length property of Function (can't be overridden so was not working) Adjusted transform() to work with TextArea, Tag and Loader - at least for movement and (mostly for) scale - not rotation - thanks Stefan Meyer for report Fixed localToLocal issue with connectors when they first show with base - thanks Markus Hoevermann for the report8. MEMORY
Patched in ZIM Cat 02 IMPROVEMENT Thanks Disco Drama for memory prompting leading the examination of all ZIM objects and functions. Here is a list of the updates so far - the adjustments to dispose() are still under way: Added disposeAllChildren() method to container (and Stage/StageGL) to remove and dispose all container children but leave the container (thanks Disco Drama for request) Added zim.KEYFOCUS check in gD (globalDispose) to remove focus reference Fixed the following for dispose() COMPONENTS List - removed a bunch or references to tabs Tabs - button, label references Layer - removed stagemouseup event Stepper - removed references to Label, Rectangle, Triangles Selector - added dispose to container TextEditor - removed references to all parts so they dispose - color, font, size, etc. components TextArea - removed DOM events on TextArea tag so dispose clears from memory KeyBoard - changed .name properties to .na properties to not conflict with .name/nam() global properties Organizer - extended Tabs but had its own that.buttons which overrode the Tabs buttons so it could not be disposed (3 hour bug) Connectors - removed keydown event so can dispose properly Checked all components. 12/08/20 METHODS animate() - Animated objects were being held in memory even if disposed. This has been adjusted. tap() - Objects with tap() were being held in memory even when disposed. This has been adjusted. wire() and wired() - DisplayObject dispose() methods now check for wire or wired and removes the connection - freeing the object from memory. // also checked drag(), gesture(), transform(), with no problems TODO - more methods, shapes and controls9. LAYOUT
https://zimjs.com/explore/layouts.html If the object in a region is given a type="Region" then it will have its bounds set to the region size. This allows for another Layout to be nested within a region and scale to the inner region. For example: var content = new Container(500,500); content.type = "Region"; // this now will have its bounds set to the region size If the object is a Container (usual choice) then it must be given a starting width and height which will be reset to the region size and resized to continue to match the region size. Thanks Zeke Chan for the prompting10. ZIM DEV SITE
https://dev.zimjs.com (link also on front page at top right) Created a site for developers with a toned down "expression" and focused on how to put ZIM into other frameworks and other libraries into ZIM Includes 24 examples of ZIM Components, Conveniences and Controls plus the code. Provided review from developers (thanks, Iestyn, Ami and Diso) Summarized the versions of ZIM - ONE, DUO, TRI, 4TH, VEE, SIX, HEP, OCT, NIO, TEN, CAT Provided articles from Medium - https://zimjs.com/medium Also started writing articles at DEV.to - https://dev.to/zimlearn11. ZIM LAB
https://zimjs.com/lab.html Replaced ZIM ZOO (https://zimjs.com/zoo.html) with ZIM Lab for a more generic online editor Includes 8 samples: BLOB, EMIT, ART, BALLS, SYNTH, RADIAL, SPRITE, and WIG12. ZIM ZOOM
Held a ZIM ZOOM previewing ZIM Book Thanks for those that came out and shared stories and updates! Keep in touch at https://zimjs.com/slack for the next meet.13. UPDATED
Home page Cat Mini Site, CDN, Code Page, Slack, GitHub, Distill, NPM (11.2.1), TypeScript, Templates, Bubbling Videos,
ZIM Cat 01 - added 31K - August 28, 2020
1. DOCS
Added THREE, SOCKET and PIZZAZZ at the bottom of the ZIM DOCS after GAME. The ZIM modules are now in the docs The code remains external and available in the CDN or in links at the top of the docs. The files still need to be called with a script tag after calling the CreateJS and ZIM scripts. Added an Images section after Frame and above Sounds to help people see how to load images. This describes loading image assets but the code for doing this is in Frame still.2. GENERATOR
https://zimjs.com/cat/generator.html Used for dynamic drawing such as generative art or visualizations. Generator provides a set of RELATIVE drawing commands that primarily match the traditional absolute drawing commands for shapes on the canvas. Rather than add all these commands to the Shape class they have been added to the Generator class. This optimizes the Shape class which is used for all components and ZIM shapes. The arrangement is similar to Processing (or P5js for a JS version). There is one Shape that gets drawn into and code can be put in three different callback functions: setup - happens once at the start (similar to Processing) draw - happens at the framerate (similar to Processing) stamp - loops all at once (different that Processing?) >> SETUP The optional setup runs once before the draw or stamp functions run. This function will not be used as much as in Processing because ZIM has a Frame(). Also, things can be set up before the Generator code is called. And the Generator class has parameters for color, strokeColor and strokeWidth. Generator defaults to start at the center of the stage - so in the setup, translate(-stageW/2, -stageH/2) could be used to start at the top left. >> DRAW The optional draw function runs at the framerate and receives count and total parameters. This will have the affect of animating the drawing as it "processes" the code By default, this will pause and unpause when the screen or the spacebar is pressed. >> STAMP The optional stamp function runs inside a loop and produces the final drawing at once. The function receives count and total parameters. You can switch between the stamp and draw function with the same code inside. The end product will be the same. >> RELATIVE The draw and stamp work the same way, running the code inside for each count. The magic happens because the commands are relative. Even g.rectangle().rotate(5) is beautiful. Each new rectangle after the first will be rotated 5 degrees In absolute space, the corner points would have to be calculated with sine and cosine - ew. Generator does the matrix calculations to avoid this. Each new command starts where the last command left off. But each command also has an x and y value to translate if desired. This x and y value is relative to the current rotation and scale. Often, the x and y is left at 0, 0. We considered removing them as parameters because translate() can be called but we left them in to be the same as Processing. >> COUNT, PAUSE AND STEP The count parameter of draw or stamp suplies the current count. This provides ways to modify commands. for instance circle(0,0,count*10); will draw circles that get bigger. This can also be used to set the rate of change - often by using smaller factors such as count*.01, etc. Count can also be used to pause or do something different at certain places in the drawing Pause also has an optional number of seconds to pause or a ZIM interval() and pause(false) can be used. Generator has a count property which can be set to go forward or back to a certain count. Step calls a step - usually used when pause is true - an interval could then be used for steps >> PUSH AND POP There is also push() and pop() as in Processing. These remember the position, rotation, scale and skew when push() is used and then return the generator to these settings when pop() is used. Multiple pushes can be set and then popped back. These can be used to make fractals with recursive branching. The drawing uses matrix transforms on Shape which takes the shape out of traditional positioning. A drawing property is available on the Generator that points to a Container that holds the drawing. This container can be moved, dragged, etc. so use this to manipulate the drawing in a traditional manner. The generator has a shape property which can be used to access the raw shape for absolute drawing for instance. The drawing container is automatically added to the default stage as the Generator is created3. CONNECTORS
https://zimjs.com/cat/connectors.html Added a new component called Connectors that has nodes that can be dragged and connected with lines. There are three main uses: 1. Connecting dots like in coloring books - use linear:true (thanks Karel rosseel for the idea) 2. Making hieararchy type drawings - use snaps 3. Connecting objects like boxes together - pass in objects to the points The num parameter limits the number of lines that can be drawn from a node. The dropType can be set to require nodes to be dropped on or off other nodes (or the default, any). There are min and max distances the connections can be made. These and the other parameters provide a variety of game and puzzle options. The Line can be set to have start and end heads. The lineType in the Line can be set to "straight", "corner" or "curve" Line also accepts points for any arrangement of a connector but in this version, these have not been used in Connectors. Currently, there are no pre-made lines - the user would have to make these. In future versions, we will look at making nodes and lines based on a ZIM Hierarchy object. This would also allow use to handle undo, redo and save.4. LINE
Added lineType, lineOrientation, curveH, curveV, points as follows: lineType - (default "straight") - by default the line is a straight line between points set to "corner" to draw only horizontal and vertical lines at 90 degree angles between lines (see lineOrientation) set to "curve" to draw horizontal and vertical lines with curves between lines (see lineOrientation) lineOrientation - (default "horizontal") - for lineType other than straight draw two horizontal lines and one vertical line between points set to "vertical" to draw two vertical lines and one horizontal line between points curveH - (default 100) - for "curve" lineType this is the horizontal distance of the curve curveV - (default 100) - for "curve" lineType this is the vertical distance of the curve points - (default null) an Array of points for the line which will ignore length and lineType parameters points in the array can have the following formats (a mix is okay too): [x,y] points for straight lines. This format should also be used for first point [cpX, cpY, x, y] for quadratic curve to with a single control point followed by the destination point [cp1X, cp1Y, cp2X, cp2Y, x, y] for Bezier curve to with start and end control points followed by the destination point // see the ZIM Shape docs (or https://www.createjs.com/docs/easeljs/classes/Graphics) for details on the curves Fixed cloning of line ends - were not adjusting their start angles also ZIM VEE heads were not cloning the decisions but rather moving them to the clone5. COLORS
Added toColor(targetColor, ratio) method to Strings - just like lighten() and darken() So blue.toColor(pink, .2) is a blue color a little ways towards pink6. SERIES
Added range to series: var s = series({min:1, max:5}).step(.1).bounce() // would return 1, 1.1, 1.2, etc. to 5 and back again, etc. every time it is called // Added every() method to series: var s = series(red, green, blue).every(3) // would return red, red, red, green, green, green, blue, blue, blue, red, red, red, etc. Remember, these are used with ZIM VEE Which can be used in the new Generator (and Emitter, Tile, STYLE, etc.)7. LOADER FOR TEXT AND JSON
Added type parameter to Loader BREAK after the label parameter before all the colors, etc. This defaults to "image" and can be set to "text" or "JSON" for loading these types of data The event object of the loaded event function will receive a text or json properties for the results. Also handles multiple files - thanks Ami Hanya for the prompting8. MADE WITH ZIM
There is a frame.madeWith() method with some color and wording options Thanks Iestyn for the prompting. There is still the makeCircles(), makeIcon() and makeCat() methods as well9. FLIPPER
https://zimjs.com/cat/flipper.html Takes a ZIM Tile and scrambles its items allowing the items to be dragged to unscramble. Works on horizontal, vertical or grid versions of Tile (as in one column, one row or multiples) Dispatches a "complete" event when done. Can pass in an optional keys array that must match key properties or an existing property of type keyType. This allows, for instance, matching duplicate letters or colors.10. CORS
https://zimjs.com/cat/picture.html JavaScript on the Canvas gives CORS (Cross Origin Resource Sharing) errors when interacting with an image or sound from remote sites (without arranging for CORS) Now, adding https://cors.zimjs.com/ in front of a full URL will avoid CORS errors on assets from remote sites. eg: https://cors.zimjs.com/https://somesite.com/somepath/someimage.jpg This should be used only when there is a CORS issue and not just to work with your own assets locally on your computer. For that, please adjust your browsers according to https://zimjs.com/tips.html#IMAGES Thank you Disco Drama for the work on this.11. SOCKET
https://zimjs.com/socket IMPROVEMENT Socket lets you connect with multiuser sockets for chats, avatars, etc. There is a ZIM socket file and a ZIM server file as well as socket.io. ZIM Socket has been updated to https and hosted reliably. Thank you Disco Drama for the work on this.12. DISTILL
https://zimjs.com/distill IMPROVEMENT Distill lets you minify only the ZIM code used in the app. This can reduce code from 600K to often around 100k. This service has been updated to https and hosted reliably. Thank you Disco Drama for the work on this.13. WONDER
https://zimjs.com/wonder IMPROVEMENT Wonder lets you record microstats like button clicks, time spent in areas, etc. This service has been updated to https and hosted reliably. Thank you Disco Drama for the work on this.14. GENERAL
Made loadAsssets() dispatch a complete event even if no assets passed to it - helps in dynamic systems (thanks Ami Hanya) Added toEnd parameter to stopAnimate(). If set to true, will make targets go to end values of their tweens (this will ignore specific ids) Adjusted endTween() callType parameter to default to "all" rather than "none" this will now call the call function (and all series call functions prior) when endTween() is run Thanks to Disco Drama for suggesting the endTween and callType parameters. Adjusted Page to have backing size the size of the screen by default with container dimensions the zimDefaultFrame width and height Adding Layout to Page will now keep the same background color or pattern by default as the frame is scaled. Pages object now automatically swipes horizontally from page to page without wrapping (thanks Andi Erni for the request) specify swipe lists if some other swiping is desired or specify a swipe property of [] on one of the pages to turn off swiping Switched rotate parameter of MotionController to orient to match animate property of the same name. Added rotate property to end of parameters for backwards compatibility but this is now depricated. Fixed MotionController to keep start rotation when orient is set to true. Adjusted MotionController so flip does not work when target starts at an angle other than 0. To rotate a target and use flip, use a Container as the target and put a rotated object inside the container. Window and List - any drag() will now not swipe with ZIM Swipe() unless overrideNoSwipe is set to true in Swipe parameter Thanks Andrew Lee for pointing out this feature was undocumented An alternative to overridNoSwipe is to use setSwipe() on the object - note, the drag on Window and List is added slightly after the Window or List is made so will have to use setSwipe() in a Timeout perhaps of .1 second. The overrideNoSwipe parameter does not need a delay.15. SITE
Updated Wonder, Distill, AssetList, Socket, LeaderBoard and Frame pages with latest ZIM icon.16. PATCHED
Adjusted the VERSION to cat/01/zim - thanks Stefan for the catch! Adjusted stopAnimate(id, toEnd) to handle ids with toEnd - there was a bug and adjusted endTween() to work across multiple animations and added suggestions to Docs. Thanks Disco for the report. Removed a duplicate property deep in animate code and changed a var poo to po and updated diffX and diffY in Squiggle and Blob to be vars - thanks Stefan for the finds. Stefan Meyer from Uruguay ran ESLint on ZIM so we went in and updated a bunch of issues like missing vars, duplicate definitions, semicolons, etc. Updated cloneAll() method to have style, group, inherit parameters Fixed subsequent allowToggle settings in transform() Adjusted show and hide of HotSpot() to use but rather than older backing variable Fixed noise wave in Synth() to run with oscillator.context Fixed series({min, max}) to properly loop on max number Adjusted series({min, max, step}) to create an array and then just use array code - that means step has been added as well. Fixed array creation to handle step properly. Adjusted zimify() to not zimify() and object that already has had zimify() called on it - thanks David Dorin for the report! Went back and did 10.9.0 (popular ZIM SHIM version) and cat 00 as well as this 01 and beyond. Added maxConnections parameter to Frame and loadAssets() thanks Disco for the suggestion This flows through to the CreateJS PreloadJS to the loadQueue setMaxConnections() method Adjusted Organizer remove(index) to actually remove the item at the index rather than at the selectedIndex - thanks Disco for the report and fixed a Window scrollX and scrollY setting issue due to an added timeout earlier. The setting of the scroll values was setting to right position but then the 50ms timeout set the content position back to where the scrollbars were at. Adjusted Window to also drag after 300ms when dragBoundary is set - after enabled or disabled This related to conflicting with damping on scrollbars or something like that... Fixed removeAt() for List to properly adjust the selectedIndex Adjusted transformControls dispose() to turn off events on handles, etc. - thanks Ami Hanya for find Fixed KeyBoard to work again with blank Labels - thanks Ami Hanya. Added scrollEnabled property to Window (and therefore List) - thanks Ami Hanya for request. Adjusted Dial to work with mouseMoveOutside when set to true in Frame Made Radial and RadialMenu style and inherit parameters pass through for its center circle and labels Adjusted RadialMenu to not start with selection when adding rings Renamed internal level property to ringLevel now that DisplayObjects have level property Added scrambled event for Scrambler which dispatches when scrambling has stopped LabelOnPath was needing stage update on toggle Called toggle(true) on path to set clicking off path to hide controls. Added frame parameter to Sprite so can load assets from Frame other than zimDefaultFrame Fixed pause(false) on MotionController to work properly - was a lastSpeed scope issue Adjusted noDrag() to properly close drag when slide is true so next drag() will work properly This was affecting the toggle of enable for Window and List - important if animating a list for instance. Adjusted the addAt() and the removeAt() of List to not go to the top each time. We do not know why this was put in there - it may have been to prevent some bug. We tested and it seems to work fine just leaving the list where it is. Apologies for the List work... it is quite complicated as it uses Tabs in Window and has all sorts of thing going on. Added frame parameter to Pen just before the style parameter to let Pen be used on other frames Parallax addLayer() removeLayer() step() immediate() pause() - returns object for chaining Added frame parameter to Generator just before the style parameter to let Generator be used on other frames Fixed scaling stutter in non-Retina full mode after 10.7.1 fix - did not patch other versions as non-Retina is unusual Fixed toggle on Button - error intruduced in ZIM Cat - the original value was set when setting text property this was good until toggle set the text property and changed the original value to the toggled value - etc. Also set the default rollToggleBackgroundColor and rollWaitBackingColor to the rollBackgroundColor by default Patched interactive property for Squiggle and Blob was overwriting showControls method fixe to set _controls Added wait parameter at end of wiggle() - will probably move this up to after main parameters in CAT 3... handy! Patched Sprite when loading with JSON file to find frame parameter to get asset properly thanks Ami Hanya for the catch (since the last patch with the frame parameter) and thanks Ami for the next one too Made Window and therefore List update the stage when closed with the close button. Took out extra ticker parameter at end of wiggle - typo Fixed TransformManager to work with persist when adding objects to start and after with add() - needed to call persist() after later add(). Fixed dispose on Window() and List() when interactive false - thanks Stefan Meyer for these three fixes. Adjusted Frame loadAssets() to move asset property outside init() so loadAssets() works in Animate with ZIM SHIM Thanks Shana B. The init() does not get called as the stage is already made with Animate. IMPROVEMENT Fixed svgToBitmap on Safari - thanks Heneman for the report. It was a bad mime-type that came from Internet code type: "image/svg+xml;charset=utf-8" should have just been type: "image/svg+xml" IMPROVEMENT Fixed SVGContainer and the Blob/Squiggle SVG input for points to include working with an arc We used https://github.com/colinmeinke/svg-arc-to-cubic-bezier We also found that 12.45.56 is actually parsed as 12.45, .56 so that was a glitch we fixed too Here is the test file: https://zimjs.com/test/svghair.html - thanks to Heneman for the request IMPROVEMENT Disposed shapes in dynamic mask for better performance - see https://codepen.io/zimjs/pen/xxORooW Adjusted Sprite run() to set running false before calling the call so a run() command inside the call works properly Made GPU true in Frame set retina to false - antialiasing looks really bad with retina true - also resizing frame with retina and gpu was not right. Added tremolo to Synth play() to match tool at https://killedbyapixel.github.io/ZzFX/ - thanks Nikola for the find (and Frank Force for the tremolo) Added getLatestTime(propertyName) method to ZIM Socket to get the latest server time that a property was updated Adjusted ZIM animate series code to fix typo bug - thanks Ami for the find. Added font, bold, italic, and variant local variables to Label so clone will clone these if changed with properties before cloning - thanks Marva Patched Bitmap.fromData() to properly grab the image width and height then make the Bitmap and callback. Thanks Stefan for the report. Made the TextEditor dispatch an "update" event for every change made to the text - thanks Marva for the request. IMPROVEMENT updated Sprite so that pauseOnBlur activates the sprite again when the user goes to another tab and then tabs back. Thanks Chris S for the report Fixed typo in Line to handle no endHead - had a test for startHead by mistake. Thanks Ofweird Top for the find.17. GAME 2.4
Updated ZIM game module to game_2.4 to convert time to seconds by default in various places Also changed board.update() to not rescale the objects - thanks Jasmin for the report! Added moveTo() for absolute animation in Board Added movingstart event for when move() or moveTo() is called - for instance from keys. Added nextCol and nextRow properties to moving items to find out where they are moving to.18. OBJECT
Added object() global function or zim.object() if zns is true (ZIM namespace pre-load variable) This lets you get any named DisplayObject Added nam() short chainable method to set the name property - thanks Disco for the idea Or use the name property (also parent.getChildByName() still works for Container children with names set)19. DRAGGABLE
Added a draggable property to DisplayObjects that calls a basic drag() or noDrag() This allows drag state to be recorded - for instance using ZIMON. Thanks Stefan Meyer for the suggestion - and I think we had an earliers request for this too... removed the readOnly draggable property from PEN - BREAK20. DOC VIDEOS
Added videos to Docs for: TEN: Bind, bind, Flare, Wrapper, Beads, LabelLetters, Radial, RadialMenu, DPad, Marquee, hitTestPath, ZIMON, Physics, addPhysics, CAT: Generator, Connectors, Flipper, Socket, Synth, wire, wired, TextEditor, Poly, Page, Line, Scrambler21. UPDATED
CDN, Code Page, home page Cat Mini Site, Bubbling Videos, slack, GitHub, Distill, Templates, TypeScript, NPM (as 11.1.2)
ZIM Cat - added 64K - June 01, 2020
1. TIME
Time now defaults to seconds rather than milliseconds. BREAK Added TIME constant that can be set to "milliseconds" or "ms" to go back to time as it was. This is everywhere that time is used in ZIM most notably in: animate(), wiggle(), timeout(), interval(), But also in Emitter(), Sprite(), Tip(), Layer(), KeyBoard(), Marquee(), Button(), Swiper(), Swipe(), ProgressBar(), Waiter(), Stepper(), Accessibility(), gesture, added(), hold() and Frame() The reasoning behind the time change is that ZIM is for the people not only for hard-core coders and seconds just makes it more familiar. GreenSock animates in seconds so there is perhaps an industry shift.2. SYNTH
https://zimjs.com/cat/synth.html https://zimjs.com/cat/synthpad.html Added ZIM Synth() with two main functions play() and tone(): 1. play() is Frank Force code ZzFX to play and create sounds with many parameters https://github.com/KilledByAPixel/ZzFX https://zimjs.com/cat/sounds.html There is a tool here: https://zzfx.3d2k.com to easily make sounds. Then just paste the resulting code into a ZIM Synth play() method. This is great for game sounds, etc. 2. tone() is a ZIM tone - continuous or with a duration. This uses the native JS Web Audio API to make oscillators with frequency and gain. The API is fairly complicated and cumbersome so this makes it easier. tone() plays a note "A", "Bb", "C#", "A4", etc. and notes can be added. The low notes are "C0" then each number increase goes up an octavet to "G8". New constants are provided: SINE, SQUARE, TRIANGLE, SAW, ZAP for wave shapes. tone() also plays WaveTables - of 50 different sounds available on the ZIM CDN Effects are "wah", "tremolo" (pitch / frequency) and "vibrato" (gain / volume) Properties can be controlled with interaction, components, MotionController, animate, wiggle, etc.3. DIAL AND SLIDER
https://zimjs.com/cat/synth.html IMPROVEMENT Added to and adjusted parameters for Dial from after tickColor to before limit: tickColor, tickStep, semiTicks, tickScale, semiTickScale, innerCircle, innerScale, innerColor, inner2Color, accentSize, accentRadius, accentColor, accentBackgroundColor, accentDifference, sound, linear, gap, limit Dial gets a new indicatorType of "aztec" Slider gets the same except for the inner parameters Added four more button types to Slider: "pill" - a narrow rectangle with rounded corners "aztec" - a quadrilateral with fat side and skinny side (default for sound) "circle" - a circle - can be oval with different width or height "grip" - adds three grip lines to button Added semiTicks to Dial and Slider - set to 1 to alternate between big and small ticks set to 4 to show 4 ticks between big ticks, etc. Changed useTicks to work independent of steps Added tickStep that defaults to steps but can be set independently will be 1 by default if no step Added linear value to Dial that lets dial go up and down based on vertical movement only Added accent parameter to both that adds colored bar and background bar that can be offset The accent can be made really small, put under or outside the component, etc. The slider accepts gradient - the dial does not as it is a Shape (custom shapes can be put under Dial for gradient effect) Added sound parameter to Dial that rotates the dial 180 and switches to linear mode Added sound parameter to Slider - sets accent, button to "aztec", colors, etc. Remember, to get an actual number, use a Label set to the currentValue in a change event4. STYLE
IMPROVEMENT Added Style() class - see STYLE in docs and scroll down This has a set of static methods to help organize and manipulate sets of styles These are very small and like STYLE, they affect only new objects objects already created will not be changed: Style.clear() Style.clearTypes() Style.clearGroups() Style.remembered Style.remember() Style.clearRemembered() Style.recall() Style.add() Style.addType() Style.addGroup() Style.remove() Style.removeType() Style.removeGroup() Added zim.styleTransforms() function and documented how to add STYLE to custom classes https://zimjs.com/explore/customclasses.html See the Docs on STYLE for the four steps to activate styles on custom classes extending ZIM Classes5. ZIM BASE
https://zimjs.com/base.html Created ZIM BASE in PHP to handle MySQLi - cutting code by at least half This works with ZIM Bind(), async() and Ajax() to provide easy data on the server side. There is a Skool section on Data under Lesson 09 and videos on Base and Bind as part of the Learn JavaScript with Creative Coding6. WIRE
Added front-end binding with ZIM wire() - leaving ZIM Bind() to work with external binding. ZIM wire() and wired() are methods that offer an alternative to events. These are simple methods that work similar to Bind - with chosen objects, properties, filters and calls. For instance: new Slider().wire(circle, "scale"); // would change the scale of the circle as slider is used. // This would be like the ZIM: new Slider().change(function(){ circle.scale = slider.currentValue; stage.update(); }); // or the CreateJS: var slider = new Slider(); slider.on("change", function(){ circle.scale = slider.currentValue; stage.update(); }); // or the traditional JS: var slider = new Slider(); slider.addEventListener("change", function(){ circle.scale = slider.currentValue stage.update(); }); Wire is 25% the code of the traditional JS event. Wire methods can also be added to any objects with addWires() global function WIRE WORKINGS The wire() method calls an optional filter function before setting the value and an optional call function after setting the value. The filter function receives the value and must return the value - but the value can be changed in the filter function if desired. The wired() method is the same but is set on the receiving object - as that may be made afterwards. Each has a rebound parameter that can be set to also reverse the properties so if the circle changes scale, it would change the slider value. An optional input parameter exists if the value is not the component's default selectedIndex or currentValue. A DEFAULTWIRE constant is provided to set preference at any time to selectedIndex or currentValue. Non-components can be used too - for instance circle.wire(circle2, "x", true); // true is rebound When circle changes, circle2 would match its x. When circle2 changes, circle would match its x. Stage update is handled internally. The wire() or wired() function (not method) can be used to wire non-ZIM objects - like an object literal {}. For instance, point = {x:10, y:20}; wire(point, circle, ["x", "y"]); Anytime the point changes, the circle would change to match x and y. wire() and wired() can be turned off with noWire() and noWired(); This all works with a single function added to the ZIM Ticker that checks for each change in order added. A single stage update is provided at the end by the Ticker - tied in with animate, wiggle, drag, etc. for optimization.7. PAGE
https://zimjs.com/cat/page.html Added new Page() class - that is really just a Container with a Rectangle backing And a few conveniences for color and pattern. But it stops people from wondering how to make a page in ZIM so that's okay.8. PAGES
https://zimjs.com/cat/page.html Added Emitter transitions and the ability to add a custom Emitter to transition parameter of ZIM Pages()9. LINE
https://zimjs.com/cat/line.html Added a new Line() class that has features of other ZIM shapes like Rectangle, Circle, etc.10. POLY
https://zimjs.com/cat/poly.html Added a new Poly() class that has features of other ZIM shapes like Rectangle, Circle, etc.11. ASSETS
https://zimjs.com/cat/sounds.html - see the cat asset ZIM asset() can now be called without preloading assets ZIM will temporarily use an empty container as a placeholder and then automatically load the asset in the background. If you do not supply dimensions then ZIM will re-call any positioning once the asset has loaded An auto-loaded image will be of type "Image" - as it is actually a Container holding the Bitmap This container has its mouseChildren turned off - and the Bitmap can be accessed with a bitmap property In general, loading assets with the frame asset parameter or in loadAssets() is encouraged But test this out - it may be that you do not need an asset to be preloaded and it saves a step. ZIM Asset Object now handles multiple paths that override the main path parameter var assets = [{id:"file", src:"test.png", path:"alternate/"}, "other.png"]; var path = "assets/"; will load test.png from relative "alternate/" path and load other.png from "assets/" path Absolute urls always ignore the provided path parameter So the above is accomplished by parsing the full path to the current file and adding the alternate path to create an absolute URL that then ignores the path12. SOUND
https://zimjs.com/docs.html?item=Sound There is now a Sound entry in the Docs Sound is handled automatically in ZIM by a CreateJS Sound object (for all sounds) But we have added information about Sound to the ZIM docs for convenience. The play method now has traditional parameters or a configuration object (ZIM DUO) asset("sound.mp3").play(volume, loop, loopCount, pan, offset, delay, interrupt) Setting loopCount:2 will loop twice - no need to set loop:true (this also has been changed for animate as well) Sound now features interrupt (available through CreateJS) This allows you to specify what happens when multiple occurrences of the same sound are played. Previously they would just play on top of one another and that is still the default (up to 100 copies - or 2 in IE) Now, a maxNum property can be added to the ZIM Asset Object for a sound var assets = [{id:"sound", src:"sound.mp3", maxNum:1}]; // not available just using "sound.mp3" as the asset This means that only one occurrence of a sound with the same source will play at the same time When the sound is played an interrupt parameter can be provided with four possible values The default is "none" which will not interrupt the previous playing sound Set interrupt to "any" and it will stop playing any the same sound and start it over again This is a pretty good setting for playing a sound with a button - it starts over. Or just leave it as "none" (default) to ignore further button presses and keep playing the sound without interruption - until it is done then if the user presses the button the sound would play again.13. MOVEMENT
Added movement() and noMovement() chainable methods to capture mouse movement on object CreateJS provides a stagemousemove... sigh... but no mousemove events sigh. General mousemove events are a little performance expensive but we need them sometimes and it is a few steps to set up with a mouseover and mouseout Here are those steps wrapped up in a nice easy method. Object dispatches a "movement" event when stagemousemove or obj.pressmove happens on the specified object call noMovement() to turn off.14. SCRAMBLER
https://zimjs.com/cat/scrambler.html Added a new control to ZIM that accepts a Tile and scrambles it also letting the user drag tiles to try and unscramble for instance. This works as a horizontal row, vertical row or a grid and is very handly for e-learning app unscramble questions and can be used to unscramble a picture15. TILE
Added unique parameter BREAK to after spacingH and spacingV before width and height Initially, Tile was used to tile the same object - but it has proven handy for layout components, etc. This parameter will simplify the layout process by automating count and clone settings unique - (default false) - set to true if tiling unique items like components with events set or objects with custom properties 1. this will turn off ZIM VEE for the obj parameter which will accept an array of unique objects 2. the count parameter will be set to the length of the array 3. and the clone parameter will be set to false Made Tile default to 3x3 circles if nothing specified Added tileCol and tileRow properties to each tile object (already added tileIndex property) - this was patched in 10.9.0 Added itemUnderPoint(x, y, ignoreSpacing) to Tile to efficiently get the tile item at the mouse for instance Added read only current, current2D, current2DCols properties - like items, items2D and items2Dcols that give the current order of the Tile if it has been scrambled for instance This could be relatively processor intensive so try to use it on click or pressup as opposed to pressmove or Ticker Removed getItems2D() method in Docs - that was not an actual method as we went to items2D and items2DCols properties16. ZIM SHAPES
Added a ZIM CustomShape class that handles common properties - saves 25% code per shape. Added support for dashed array [10,30] 10 fill, 30 space... or [10,30,100,30,10,30] etc. Added dashedOffset property (note dashed with ed) that can be set and animated for a Marquee effect. These were already built into a raw CreateJS shape (and a canvas shape) but now brought them to the custom ZIM Shapes. Added a cloneAll() method to shapes in cases where content is added to the shapes - usually a Container is advised.17. ANIMATE
Added easeAmount and easeFrequency to animate() - these call CreateJS dynamic eases easeAmount - |ZIM VEE| - (default null) set to change the tween effect Ease amounts are as follows: quad (default 2) - exponent - this is the default ZIM tween cubic (default 3) - exponent quart (default 4) - exponent quint (default 5) - exponent back (default 1.7) - strength elastic (default 1) - amplitude - also see tweenFrequency linear, bounce, circ, sin - no affect Note: used mostly with back and elastic (backIn, backOut, backInOut, etc.) as setting the tween to quadInOut and then tweenAmount to 5 would be the same as a quintInOut. easeFrequency - |ZIM VEE| - (default .3 elasticIn and elasticOut or .3*1.5 elasticInOut) set to change the elastic ease frequency so tween:"elasticOut", easeFrequency:.2 is a faster elastic the time may also need to be increased or decreased as desired also see easeAmount where easeAmount:3 would be a larger elastic Added a timeUnit parameter to animate to manually override the TIME constant if desired IMPROVEMENTS Adjusted animate() so setting loopCount to a number will automatically set loop to true (no need to also set loop true) Fixed actually setting orient:true for paths to work properly This already worked properly as default which is true - but now works if set it to true Also fixed so can flip false and orient true - that was always rotating to the path in the past Also, default to flip true for orient true and this avoids a little flash as object was dragged and thrown in opposite direction - so all is looking good. Fixed bug in replayTween and resetTween when tween had ended and with startAngle on path. Adjusted ZIM animate() series to work with replayTween() - does not work with a series that includes multiple targets Added the CreateJS CSS plugin to the ZIM CreateJS 1.3.2 version - so can now animate CSS without installing plugin (17k)18. SELECTOR
https://zimjs.com/cat/synthpad.html Added multi parameter BREAK to handle multitouch - for instance musical touch pad Made selector receive backgroundColor and borderColor ZIM VEE values to set custom selector colors Fixed clone to work19. TEXT EDITOR
dedicated to Ami Hanya - long time ZIM user and enthusiast https://zimjs.com/cat/texteditor.html Added a ZIM TextEditor() class that edits ZIM Label objects with modular features - just plain text edit, color, size, bold italic, align and font has a show(label) method to work on a specific label.20. LABEL
Added bold, italic and variant parameters and properties to Label BREAK . Added font, align and valign properties to Label Removed fontOptions. BREAK - this conflicted with parameter settings unless a lot of code was written.21. BUTTON
Added toggleBackgroundColor, rollToggleBackgroundColor, toggleColor, rollToggleColor to after toggle in Button BREAK adding these more easily allows a button to act like a fancy checkbox before adding these we had to use custom backings and icons for toggle color changes See the new TextEditor for an example with B, I and align icons using toggleBackgroundColor22. BIND
Added toUnique() to Bind which sends unique=true to server Adjusted toLock() to ignore from data that is not adjusted Fixed up the docs as to when to use toLock() This is when multiple people are appending to or editing part of a shared JSON object If people are completely overwriting the object then just use to(). Added stop() functionality to the from filter (already on the fromTo and to filters) Added setDefault parameter to Bind - to set as zimDefaultBind Added default property to Bind to get or set bind as zimDefaultBind the zimDefaultBind is what DisplayObject bind() method will use unless bindObj is specified Adjusted removeAllBindings() to return the bind object for chaining Adjusted filter process to allow data object to be replaced not just updated the returned data was not going all the way due to passing via reference issue Added unique parameter to ZIM Ajax()23. VERSION
Added a VERSION constant and getLatestVersions() function - thanks Ami Hanya and others for the request. getLatestVersions() calls ZIM async() to get the latest versions of all files relating to ZIM the callback receives a versions object with zim, createjs, physics, etc. properties So, in the callback function - if (VERSION == versions.zim) will tell if ZIM is the latest.24. GENERAL
*** IMPROVEMENT *** Can now use key arrows and shift key arrows to move object with place() - yay! Just remember to remove the place() once placed! *** Loop now loops through a string giving each letter. *** Made ZIM expand accept 1, 2 or 4 parameters and accept DUO - for STYLE mostly... *** Added pause(state, time) method and paused property to MotionController - deprecated enabled. *** Added wrap and maxLength parameters to TextArea *** Added ability to add Rectangle or stage as boundary to drag() this will keep object inside rectangle without calculating based on registration point *** Added "pressdown" event to all DisplayObjects - same as mousedown but matches pressup this was a few lines of code to wrap the mousedown function *** Added hitTestCircleRect() for calculation based (fast) detection of rectangle to circle hits! *** Added close and closeColor parameters to Panel as well as a get set panelHeight property BREAK *** Added currentValue to list - reads label text or finds first label containing provided value *** Bitmap now has top and left parameters to shift where the image will be drawn BREAK *** Added setLinearVelocity and setAngularVelocity to objects with Physics to override forces25. GENERAL FIXES
Adjusted drag() to optionally use any DisplayObject as boundary and if so, keep object within bounds - even for dragging containers with objects (one level deep) Fixed centering on container with 0 scale bug - temporarily set scale to .000001 then back again for x or y Adjusted List tabs not to inherit borderWidth and borderColor - setting outside border was also setting tab borders can add Tabs or Button style if want to change inside Adjusted series() to turn array into a real array as opposed to function arguments. Adjusted Swiper to dispatch slidestop even if min max are not chosen This could stop early as .5 is used as a change threshold - great for x, y, rotation So set a min max for swiping to set properties like alpha and scale Added noMouse() to Emitter particles container - this improves performance Use myEmitter.particles.mouse() if you need interactivity Adjusted Keyboard to put cursor selection in right place since centering on empty container fix Added a recursive parameter to noDrag() to stop drags on children26. PHYSICS 2.1
added ability to physics.drag(object) for any number of objects at different times - either single or array. Added physics.noDrag(object) or objects in array. physics.noDrag() will stop dragging all objects. IN ZIM - changed restitution to bounciness. The parameter order in addPhysics() is the same as it was restitution is still there as a ZIM DUO parameter name - or use bounciness. We liked bouncy better, but that suggested a Boolean so bounciness was used. Made follow work with borders assigned or changed after physics is made. Adjusted drag so follow does not move when dragging - this was conflicting. For moving things and following at the same time consider control() or using forces. Adjusted the hitArea of arrows on Stepper to use expand() and reduce their size a little Adjusted keypressing in Stepper for numbers - works better now... with backspace and delete27. GAME - 2.3
Game is adjusted for the new font settings of bold, italic and variant These are added to Scorer() and Timer() so BREAK to later parameters Also adjusted internal parameter order to Meter - thanks Racheli Golan for the report Adjusted the Docs to the new Game parameters - otherwise, nothing changed.28. ZIM KIDS
https://zimjs.com/kids.html ZIM Kids now has four new intro workshops These are called Basic Bug, Bug on Path, Bug with Sugar and Bouncing Bug! The other four tuturials as well as the Spells and Magic pages are updated to ZIM Cat Note: ZIM Skook and the Learn JavaScript with Creative Coding are at 10.9.0 A note will be placed regarding ZIM Cat - TIME. Patched the command S in Mac to test the page - thanks Jonathan from Slack!29. PATCHED
Added shadowBlur and shadowColor to Scrambler for when an item is picked up - BREAK of later params Fixed a glitch in the Scrambler so it scrambles to a non-correct order Added num parameter to Scrambler to visibly scramble a number of times within the time provided - BREAK of later params This is good for scrambling a small number of things - eg. set num to 3 to scramble 4 things in 2 seconds Fixed ZIM Tips which extends a Label and we had added bold, italic and variant to Label but not to the Tips - thanks Racheli Golan for the... tip Also added bold, italic and variant parameters to the end of the tips Fixed up a typo in ZIM Base which was outputting a 3 in front of an async call - thanks Andi Erni! Fixed animate() to handle relative values when loopPick set to true Adjusted getLatestVersions() to return a JSON parsed object as expected and intended Fixed minified version for getLatestVersions() - minify is changing async() return function name ** yay! Remembered that async() has a third parameter to use the function as a string to overcome minify problem Fixed up dispose of Tag, TextArea and Loader - it called a "removed" event which was trying to delete the html tag but it was already gone - thanks Racheli Golan for the find. Fixed glitch in Scramble - so fast tripple clicks do not mess it up - applied mouseEnabled false before animating and mouseEnabled true when done Fixed bug in running Sprite from JSON - was referencing frame in Sprite and should have been zimDefaultFrame - or zdf. Thanks Racheli Golan for the find. Took off container dispose for Blob and Squiggle as that affects how they are recreated with a points change - went back to 10.9.0 and patched that there too Fixed animate() for shape tweens - the index for events needs to be updated anytime parameters change - thanks Mike Gossland for the report. Fixed Blob and Squiggle issue with bringing back controls - the mousedown -> pressdown on Shape was left in a test mode - tricky bug. Still needing to adjust pressdown so that target and currentTarget report properly... Updated Scrambler to have a swap parameter before the style parameter. Swap will not automatically shift the tiles as a tile is dragged but wait until the drop (thanks Ami Hanya for the idea) Added swapLock parameter to Scrambler to lock tiles in place that are placed - thanks Netanela for the request! Added a testItem(item, index) to test a specific item in the Scrambler Also added a complete property to the Scrambler - but usually the "complete" event would be used then the dragged tile goes where dropped and the dropped on tile goes to where the drag came from Fixed asset() without preload to addTo() as placed not after when loaded - this keeps the levels - thanks Ami for the report Added label property to TextEditor() to get or set the label the editor is applied to - thanks Ami And made the show() method also set the editor to whatever label is provided Adjusted animate drag on path to properly flip if object is rotated to start We had fixed up flip when dragging on path to be more stable and missed adjusting pre-rotated objects This is not perfect as it handles only pre-rotation of 90 and -90 or 270. Put unusual start angles in a container and animate the container if there are any issues. Added timeUnit to docs for animate() parameter and added timeCheck parameter to animate Set the min time for warning on wiggle() to 40 as we often wiggle greater than a 10 second time Fixed Button toggled text, color and rollColor when these have been changed after creation Fixed Button clone() which was missing various new toggle colors Turned ColorPicker indicator to mouseEnabled false so button shows cursor still when rolled over30. PATCHES SINCE NPM
Adjusted Bitmap so it does not specify sourceRect if being passed a video CreateJS had a warning about the sourceRect needing to be same dimension as the video Which is too bad as it would be nice to cut video into pieces too... would need to confirm that is not possible Adjusted ZIM asset object {id:, src:, type:} to include a type so a JSON file can be loaded without a .json extension for example - thanks Frank Los for the prompting! Adjusted ColorPicker selectedColor to convert to lowerCase as the colors are set in lowerCase BREAK Fixed rollBorderColor to default to borderColor Fixed Emitter so emitterPaused is true if set to startPaused false Fixed the recursive parameter on noDrag() so it can receive a false - thanks Cajoek for working through this with us Adjusted windowWidth(), windowHeight() and frame.swapRotation on mobile to not set swapRotation when in an iFrame - it was reading a wide iframe as wrong when shown in vertical view on mobile see what we mean... horizontal aspect ratio iframe on vertical device or visa versa - this was giving a false reading leading to a very confusing bug with ZIM in iframe on mobile when changing orientation Fixed Synth to play the right note to start - was trying to apply an octive shift test when we did not need to Worked on Synth to reduce crackle on Firefox - thanks Frank Force for the advice Adjusted stop() parameter to be release in seconds - not stop time Added setInput() and dispose() methods to SoundWave - to set a different sound and dispose - thanks Amy Hanya for the suggestion Added ramp(volume, duration) to Synth tone() this will set the volume smoothly without pop or crackle (as best as possible) The volume should be used only for animation. Adjusted stop() method of Synth tone() to use ramp fix - thanks Frank Force for the aid - it is better but still not perfect Swapped in a new Synth play() with updates from ZzFX - sustainVolume and decay parameters were added The patch now matches updates to the tool https://killedbyapixel.github.io/ZzFX/ and keep backwards compatibility Fixed Window resize and maximize maximize was missing stage update since we removed the constant update in window scrollbar resize was broken by that.noDrag() on end of window drag as we made noDrag() recursive so need to pass in false to noDrag to stop it setting noDrag on resize handle too! went through and checked rest of noDrag in ZIM - seems okay Fixed clone registration issue - typo was setting regY as regX Added callType parameter to animate endTween() method with three values "all", "none", "main" These will call the callback function (or not) when endTween() is used. "all" will call the callback functions in a series where "main" will not Thanks Disco Drama for the suggestion and testing The current default is "none" for backwards compatibility but in version 01, this will be changed to "all" Added a madeWith() method to Frame to create an ZIM icon with Made with ZIM beneath (customizable) - thanks Iestyn for the request! Added a noCORSonImage property to the ZIM asset object for loading assets this will avoid CORS errors by loading an HTML image into a bitmap and then applying an expand to add a CreateJS hitArea See https://zimjs.com/explore/imagewithnocors.html (thanks Disco Drama for the find!) it means that the full image will be interactive and not just the opaque parts of a png it also does not count in the progress property (bytes loaded) of the progress event - but it does trigger assetload and complete events Updated ZIM Window to remove drag bounds check if enabled is set to false this will avoid a positioning issue when animating the location of a Window or List. See https://zimjs.com/test/listmove.html as a sample of using this - thanks Disco for the report Fixed animateTo() in List to use seconds by default Fixed spacing issue on custom non-equal width objects in a horizontal List (or Tabs) - thanks Disco for the find Fixed content property of selected items in List for custom items - this was documented but missing in practice - thanks Disco for the find Added noScale to List at end of parameters before style. This will make the list not scale custom objects and ignore the listNum parameter - thanks Disco for the testing IMPROVEMENT updated Sprite so that pauseOnBlur activates the sprite again when the user goes to another tab and then tabs back. Thanks Chris S for the report31. THREE
Updated the ThreeJS helper file to version 2.1 with an adjustment to position() and resizing. If you were centering the ThreeJS then there is no change - the fix is for not centered. Thanks Iestyn for the find.32. DOCS
Added a new introduction at the top of the zim_docs.js file that explains a little bit about the ZIM philosophy with respect to ES6 and other code environments - we do not mean to be dismissive - rather just trying to guide.33. UPDATED
CDN, Code Page, templates, home page, slack, GitHub, templates, Distill, TypeScript, NPM (as 11.0.0), Blog, Bubbling Videos, Patreon Intro page https://zimjs.com/intro ZIM Kids https://zimjs.com/kids Animation page https://zimjs.com/animation ZIM Bits at https://zimjs.com/bits