This document lists the changes to ZIM DOCS from version to version.
The code that matches these changes can be found on GIT HUB.
BREAK is highlighted below if you will need to change an app when updating it to the new ZIM.
This happens if a parameter position is changed (new parameters might be placed next to related parameters)
or if a method is removed and a replacement property added, etc.
Breaks are kept to a minimum but in "later" parameter cases, ZIM DUO is often used so order is less important
Shifts in names and functionality are also more common in recently added features.
RECOMMENDATION: just leave any finished apps with the version of ZIM that was used at the time
unless you see an IMPROVEMENT that will help your app - then make sure you test after upgrading!
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);
// but and SVGContainer has been updated 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 images
5. 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 idea
8. 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 Roseel (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 columns
9. 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 charts
10. 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.
13. 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 iframe
16. VIS
Added short chainable vis() method to set visibility
circle.vis(false); // still will hitTest where alp(0) will not
17. 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 to ZIM Tips
18. 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.
19. UPDATED
Code Page, CDN, Templates, Docs, Distill, Slack, Discord, Bubbling Videos
To come: TypeScript, NPM, 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:
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 details
7. 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 swapped
9. 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 property
15. 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 working
16. 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/zoom
19. 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 bubble
20. 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 ready
22. 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:
<b>bold</b> - or <strong>bold</strong>
<i>italic</i> - or <em>italic</em>
<u>underline</i> - can use this with <a> to make a classic underlined link
<a href=url target=_blank>link</a>
<font color=zimColor
backgroundColor='htmlColor'
rollBackgroundColor=#hexColor
size=20
family=verdana
group=groupStyle>font</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 Scrambler
4. 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:
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 <br>
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 report
8. 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 controls
9. 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 prompting
10. 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/zimlearn
11. 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 WIG
12. 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 created
3. 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 clone
5. 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 pink
6. 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 prompting
8. 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 well
9. 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 - BREAK
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 event
4. 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:
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 Classes
5. 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 Coding
6. 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 path
12. 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 picture
15. 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 properties
16. 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 work
19. 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 toggleBackgroundColor
22. 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 forces
25. 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 children
26. 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 delete
27. 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 over
30. 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 report
31. 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.
ZIM 10.9.0
BIND - IMPROVEMENT
https://zimjs.com/ten/bind.html
ZIM now has data binding on any DisplayObject property that is JSON ready.
So we can easily send or receive data for setting Container, ZIM Shape, Bitmap, components, etc.
For example, Circle x and y or the text of a TextArea.
There are LOCALSTORAGE, GET and POST options
LOCALSTORAGE will store to the user's computer and is syncronous saving and retrieiving all the data
GET uses ZIM async() with JSONp for getting around security/CORS issues
so works from local computer to the server or cross domains - limit of 2048 characters of data
POST uses ZIM Ajax() unlimited data but file must be on same server as data unless CORS is worked out
There are to() and from() methods for sending and receiving data
The DisplayObjects now have bind() and noBind() methods
There are GET, POST, LOCALSTORAGE, TO and FROM global constants available that evaluate to lowercase strings
Reports can be turned on (Bind parameter and property)
and there is a bind.report() method to show a snapshot of the current data
See docs for examples
AJAX
ZIM has an internal Ajax class with get(), post() and put() methods
This is very easy to use and examples are provided
ZIM async() can still be used to get around security/CORS issues
LEVEL
https://zimjs.com/ten/bind.html - note the level is stored as well
ZIM DisplayObjects now have a level property to get and set
This just returns the parent getChildIndex() and calls the parent setChildIndex()
A level of higher than numChildren-1 will be set to numChildren-1
A level of lower than 0 will be set to 0
FLARE
https://zimjs.com/ten/flare.html
ZIM Flare makes a flare shape - a shape with a gradual widening like flared pants or skirts.
The shape defaults to a horizontal rectangle flared outwardly to the right.
The flare angleA and angleB can be specified at any angle negative or positive.
The flare axis or spine can be at any angle to the horizontal positive in the x.
The cross or end angles can be specified relative to a normal the spine so 0 is -90.
Different color and border options are available and editable as properties.
More than one flare can be created in the same shape - these are called segments.
Multiple Flare objects can be easily combined into a ZIM MultiFlare
and a special FlareBox can be used to place flares or multiFlares around a rectangle
to be used for backings on buttons, pictures, etc.
SPECIAL COLORS - IMPROVEMENT
https://zimjs.com/ten/flare.html
ZIM now has GradientColor, RadialColor and BitmapColor available as colors
These can be used anywhere a color is applied to a ZIM shape or component.
new Circle(100, new RadialColor([blue,green],[0,1], 0,0,100, 0,0,0)).center();
and they can be assigned after as a color or borderColor property, etc.
ADDED mist and fog colors #bbb and #aaa - between light and silver
NOTE: for a ZIM Shape() apply these the old way with:
lf() beginLinearGradientFill
rf() beginRadialGradientFill
bf() beginBitmapFill
ls() beginLinearGradientStroke
rs() beginRadialGradientStroke
bs() beginBitmapStroke
SERIES - IMPROVEMENT
the series() function has been really handy so we have give it some more options.
for instance, start at 3, reverse and don't go past 0 (or length-1 if not reverse):
var nums = series(0, 1, 2, 3, 4).jump(3).reverse().constrain();
Here are the new chainable methods and there is also an index property (same as jump)
step(num) - num defaults to 1 - the number of items to move the index - or use index property
jump(index) - jump to an index but do not run it - the next call to the series will run here
reverse(boolean) - boolean defaults to true - reverses direction - or pass in false to cancel reverse
bounce(boolean) - boolean defaults to true - back and forth between 0 and length-1 - or pass in false to cancel bounce
constrain(boolean) - boolean defaults to true - keeps index between 0 and length-1 - or pass in false to cancel constrain
FAST FRAME
It is recommended to use a ZIM Frame or if using Adobe Animate to use the ZIM Shim
but if you are just wanting to use some ZIM features and are working primarily with CreateJS
or legacy CreateJS code - then just call fastFrame() before using ZIM code.
Pass the CreateJS namespace and the current stage into fastFrame().
fastFrame() will create and return a very light placeholder frame as a zimDefaultFrame
and will handle various scaling settings due to ZIM Retina.
WARNING COLORS
zogy() has been used for all ZIM warning colors
ZIM warnings can be turned off by setting zon = false before loading ZIM.
CREATEJS - IMPROVEMENT
CreateJS 1.3.0 is available on the ZIM CDN https://zimjs.org/cdn/1.3.0/createjs.js (and createjs_doc.js)
This has fairly deep adjustments to mouse position, localToGlobal, globalToLocal, hitArea, mask and cursor.
Generally the change relate to scaling the stage for the window devicePixelRatio
There is a createjs.stageTransformable property set to true - this means the adjustments have already been made
this allows us in ZIM to either make the adjustments or not - and avoid a double adjustment
This update is part of a larger directive to maintaining CreateJS
We have started a Slack team and are discussing a path forward with the CreateJS team.
Message Dan Zen on the ZIM Slack at https://zimjs.com/slack if you are interested in getting involved
GENERAL
bot() and top() fix to still return obj for chaining if not yet added to stage
Adjusted talk() on Accessibility to read message only once on NVDA - thanks Nathan IMPROVEMENT
Label outline has been adjusted to align properly - thanks Racheli Golan for the guidance IMPROVEMENT
Label outline property has been removed BREAK - there still is the outlineLabel property to the CreateJS Text outline
The outline property was a container for adjusting the outline - now that it is fixed, it is not in a container
PATCHES
updated Bind to include master parameter such as an id that will get sent with all to() and from()
added extra to to() and from() in Bind() to send extra information to server
for instance a search query to will then affect the bound information like text of a TextArea
Adjusted Ajax() to handle master and command and extra in post()
Adjusted async() to handle a queue of call functions with the same name
if more than one async() with the same named call function is run at the same time
if the data comes back in a different order, the wrong call could be called
if there is danger of this happening (rare) then use ZIM Ajax
Added masterFilter, bindFilter and filter parameters to Bind(), obj.bind(), add(), to(), from(), remove()
These are functions that run before or after data calls allowing data to be adjusted
eg. if data.id = "1_a" the filter function can set data.id = data.id.split("_").join("");
The function must return data - this will modify before sending and after receiving
If only one direction is desired use the command parameter in a conditional
eg. if (command=="to") {etc.} - make sure to return the data in all cases
Removed Bind() full parameter - leave off targets and filters to send or get full data
Added report param and prop to Bind() along with report() method for current data snapshot
Added couple parameter to ZIM Bind() just before smartDecimals BREAK
Added ZIM couple(json) and decouple(json) functions to code module
These flatten and unflatten JSON - used in ZIM Bind()
This may help enter data into database tables
Added couple parameter to ZIM Ajax() - works with POST only
Added more reports when Bind() reports param is true
Added zim.colors and zim.colorsHex to lookup ZIM colors
Added a "zim" value to the convertColor() toColorType parameter
var color = pink;
zog(color); // #e472c4 - ew...
zog(convertColor(color, "zim")); // pink
Fixed and adjusted the default Frame width and height to 1024x768 to match template
Made Emitter() interval pause when screen is minimized
If you ever have something not function right after minimized - let us know.
Or if in your app falling flowers stack up at the top...
set the 5th parameter of interval to true to pause on minimize.
We did that with animate() a while back defaulting to true
But we left interval defaulting to false.
Patched background color of Tabs and List for custom shapes to be clear with expand(0)
this was faint but you could slightly see it. Thanks DNVS for the prompting.
Fixed Window when scrollBarActive was set to false - missed an update to a conditional - thanks again DNVS.
Adjusted the ZIM drag() slide mode to turn off the ticker if the slide motion has stopped
Thanks DNVS who reported the Window was constantly calling a stage update - we looked into it and that was the issue.
Added lock parameter to ZIM Ajax() to send an optional lock id to the server - where it would need to be processed
Added toLock() to ZIM Bind() to get latest values, provide a filter function where data can be updated, and then send data to server
This also sends a lock id to the server at the start to lock the record and at the end to unlock the record
The server script would need to process the lock id with a couple easy steps
This prevents updating old information in cases where multiple users share the same final JSON string data
Patched Accessibility with improved talk() method - thanks Nathan for the fix
Patched blurDetect() to not automatically unpause objects when window comes back
but rather remember which objects were paused an only unpause ones that were not originally paused
This affects animate(), emitter(). And also any timeout and interval calls with pauseOnBlur set to true.
Patched resetTween, replayTween to properly reset rotation when animating on path
Patched pointAlongCurve angle equation - better!
Was averaging from point to .05 forward rather than half way back and half way forward.
Patched noMouse() - it was not saving last mouseChildren property properly.
Patched Stage() and StageGL() to not override scale properties if retina is not on - caused problems with CreateJS transformPoint
Added a MOBILE constant that defaults to "default" and thus ZIM uses the results of zim.mobile();
If MOBILE is set to true then mobile() will always return true and so various parameter defaults will assume mobile.
If MOBILE is set to false then mobile() will always return false and so various parameter defaults will assume not mobile.
Read the docs at https://zimjs.com/docs.html?item=MOBILE - thanks Ami Hanya for the idea.
MORE BIND
added stop() functionality to after data is received in from but before data is applied (it was supposed to be there too)
adjusted toLock() to bypass to to() if type is localStorage
Fixed dragging on multiple frames - this was working fine in earlier versions - and now it is again in 10.9.0 - thanks Lee Grey for the report.
Added tileCol and tileRow properties to Tile items - there is already a tileNum property but a col and row is handy to have without calculating...
IMPORTANT - adjusted clone to clone mouseChildren property - this has been missing since the start!
Added paddingRight and paddingBottom to expand() making it three mode parameter system: (thanks Karel Rosseel for suggestion)
** one parameter for all padding
** two parameters for left/right and top/bottom
** four parameters for left/right/top/bottom with any blank to receive default 20
Fixed ZIM Pen to properly handle the number of undo commands and
stopped pen from drawing when starting outside bounds of MotionController - thanks Cajoek for the report
Fixed measure field issue with Keyboard and updated https://zimjs.com/keyboard/ to 10.9.0
dispose() now dispatches a removed event as it should when the item is removed - thanks Ami Hanya for the report
Also made ZIM Squiggle() and Blob() get removed from stage when dispose() is called.
Added a try catch for css rule reading - thanks Dimi for the find
https://stackoverflow.com/questions/49161159/uncaught-domexception-failed-to-read-the-rules-property-from-cssstylesheet
And fixed a physics removeFrom() issue where the physics object was being set to null before being removed
Updated ZIM Marquee to include marginLeft and marginRight in the ZIM DUO - thanks KV for the report.
Adjusted asset("sound.mp3").play({loop:true, loopCount:2}) to play 2 times not three times to match animate()
note - for sound CreateJS uses only a loop parameter - set to -1 forever... 0 for no loop (play once) and 1 for one loop (play twice), etc.
So the loop has been left like this - but if using loopCount then 1 is play once, 2 is play twice, etc.
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
ADOBE ANIMATE - patched scale code in ZIM 10.9.0 to work with older CreateJS in Adobe Animate
And patched again 5/23/20 to drag on stage propertly - thanks Frank Los for working through that with us
There is now a physics example included in the ZIM Shim ZIP.
Patched ZIM Accessibility to make tags outsize Adobe animation_container which is scaled
Patched ZIM Accessibility to always resize tags when resize is called - was leaving inivisible tags but they can capture focus
Thanks Nathan for reporting issues.
PATCHED CreateJS 1.3.0 - and added an new version CreateJS 1.3.1
Both are the same on the ZIM CDN - the new version is for NPM
Adjusted CreateJS hitTest() on DisplayObject() to NOT convert due to stage scale
The CreateJS Bitmap() and Shape() do not need the conversion
The hitTest() on Container() that overrides the hitTest() on the DisplayObject() does need the conversion
This fixes hitTestPoint() the ZIM side for Retina hitTests on ZIM Shape() and ZIM Bitmap()
Fixed CreateJS mouse code with scale conversion to get correct mouse position when mouse is off screen
ZIM PHYSICS - PATCH
patched physics_2.0.js to work with 10.9.0 and CreateJS 1.3.0
UPDATED
This was another huge update...
Support on Patreon https://patreon.com/zimjs is always appreciated - but only if able and never expected or required
Updated CDN, Code Page, GitHub, Distill, NPM, TypeScript, Templates, Slack, Blog, Bubbling videos, Social Media
ZIM 10.8.0
WRAPPER
https://zimjs.com/ten/wrapper.html
Added to Control Module after Tile()
A Wrapper wraps its content to the next row at a given width
The Wrapper is similar to the CSS Flexbox with the following:
ALIGNMENTS:
It has left, center/middle right then top, center/middle bottom alignments
for whole rows and columns and then for inside the rows and columns.
These may or may not be active depending on the wrapper type below
WRAPPER TYPES:
The types are spacing (default), spread, stretch, or column
A colSize is available for the column type
A rowSize is available that works with any of the above types
SETTINGS:
There are also flip, reverse, bottomFull and col/row void settings.
MARGINS:
ZIM display objects can have margins left, top, right, bottom
that will shift objects relatively inside the Wrapper
without affecting other objects in the wrapper
WRAPPER WITH WINDOW AND LAYOUT
The Wrapper is resized automatically when added to a ZIM Window.
Set the Window resizeHandle parameter to true to let the user resize.
The Wrapper resizes and scales as a region in the ZIM Layout class.
The Window also resizes - so a Wrapper can go in a Window in a Layout object.
SELECTOR
https://zimjs.com/ten/selector.html
https://zimjs.com/ten/wrapper.html (several selectors are used in this example)
Added to Display Module after Slider
A Selector acts on a ZIM Tile to provide an interactive selector that highlights a tile element.
The selector works as a select bar and a select pad.
IMPROVEMENT
Selector has a selectedIndex parameter so we
adjusted all components with selectedIndex to include selectedIndex as a parameter
BREAK - these were added just before the style parameter near the end of the parameters for
RadioButtons, Indicator, List, Stepper, Slider (currentValue), Dial (currentValue), Tabs, Pad, Radial, ColorPicker
Now an initial selectedIndex property can be done in the parameters
WINDOW - IMPROVEMENT
https://zimjs.com/ten/window.html
added fullSize, fullSizeColor and resizeHandle parameters to Window
these work to maximize / unmaximize the window when a titleBar is present
the resizeHandle lets the user resize the window from the bottom right corner
Added support for automatic resizing of Wrapper
ANIMATE
Added pauseOnBlur parameter defaults to true IMPROVEMENT
this pauses the animation when the window reduces or a different tab is selected
and helps keep animations in sync - as ZIM uses a requestAnimationFrame which slows down if the window is not showing
Also added the parameter to timeout and interval - although it defaults to false there
added loopPick parameter after loopWaitParams BREAK parameter order for anything from rewind on
this will call ZIM VEE values for animate properties again at each loop - thanks GSAP for the prompting
we always wanted to do this but CreateJS had no way to change the properties once we start the animation
so we adjusted the ZIM version of CreateJS 1.2.4 to expose the animation properties and use this to provide the feature
We will put in a pull request to CreateJS to have a line added.
After this if statement finishes: if (inject = this._injected) {
then add this.step = step; to expose the properties to ZIM animate.
Currently does not work with from set on a sequence.
Added a rate parameter near the end of animate() BREAK to change the rate of speed of the animation
This calls to CreateJS timeScale which is more efficient than the existing percentSpeed parameter
and can use ZIM VEE (Pick) to adjust each loop with loopPick set to true
Fixed sequence call to call only on last animation of a sequence (or a loop of a sequence)
Set animate to css true if there is no Frame - that lets animate be used without a Frame
Added example to dot animation to docs - also added description to props parameter
For example: animate(new THREEJS.mesh(etc.), {"rotation.y":360*RAD}, 5000);
BITMAP - BLITTING
Adjusted Bitmap to receive a DisplayObject and automatically use its cache canvas
For example if circles is a Container of Circles. The old way:
var splat = new Bitmap(circles.cache().cacheCanvas).addTo();
circles.uncache();
becomes the following - if circles was cached it stays cached if not then it stays not cached
splat = new Bitmap(circles).addTo();
COLORS IMPROVEMENT
added color.lighten(ratio) and color.darken(ratio) methods to colors
as short-cuts to colorRange(color1, color2, ratio)
red.darken(.2) gives a slightly darker red
ratio is between 0 (red) and 1 (black)
these are methods of a String and also functions darken(color, ratio), lighten(color, ratio)
Also adjusted colorRange to actually default to .5 ratio as the docs say
GENERAL
BREAK - added a percentClose parameter to Circle that defaults to true
set to false to not close the border on a Circle with a percent set
Thanks Yan Zhang for the suggestion!
Changed ZIM Game module Scorer to set type property to "Scorer" instead of "Score"
All ZIM object should return the exact class name from which they were made
In ZIM physics, for the contact callback function first parameter, IMPROVEMENT
a border will have a type = "Border" and a side = "left", "right", "top", "bottom"
but it is not really a ZIM Rectangle but just an object literal placeholder
adjusted loc() to properly set at index when index is provided and it is locating in same parent
moved move/mov style to after loc and pos so can move after positioning in STYLE
Fixed Window swiper area adjust after scrolling with scrollbar - on scrollBarDrag true
Adjusted interval to not use requestAnimationFrame - this better syncs the interval with setInterval
thanks Racheli Golan for noticing time discrepancy with fast intervals
BREAK Changed the Stepper default stepperType to "number" rather than "list"
Need to set the stepperType to list for a list of words for instance in the stepper
Set the default max for the Stepper to 10 instead of 100
CREATEJS
A new CDN version at https://zimjs.org/cdn/1.2.4/createjs.js has been provided
Note that this is the minified version of CreateJS - we have adjusted the file name
and an unminified version is at https://zimjs.org/cdn/1.2.4/createjs_doc.js
The new CreateJS exposes animation properties - with one line addition
to allow ZIM to dynamically change the animation properties after each loop - see ANIMATE above.
Patched this with Ferudun Vural fix for removing unwanted double touches - thanks Ferudun!
This has been reported on the CreateJS GitHub as well.
ADDED
Colors for zog() - thanks Yalon and Ami for the techniques
zogg("green");
zogp("pink");
zogb("blue");
zogr("red");
zogy("yellow");
zogo("orange");
Added run(time, close) method to ProgressBar to show and run the progress bar
Just runs an interval in behind and updates the percent - the close will set the autoHide setting
Added a "complete" event to the ProgressBar that fires when the loading or running is complete
PATCHED
Label outline - moved it a little center on text better
Also fixed outline when lineWidth is specified and dynamically changed (thanks Racheli Golan)
Fixed transform to dispatch a "transformed" event when changing from one transformed object to another and dragging immediately
POST NPM PATCHES
Adjusted Button so backgroundColor, rollBackgroundColor, color and rollColor get a delayPick for style - for instance buttons on Sliders
Added currentValue parameter to before style on Slider BREAK
Added a change event to Tile if items inside tile dispatch a change event
the change event object has an item property (e.item)
that refers to the item that caused the change event - for instance a Slider, Dial, etc.
note: the item is not the event object target - as that is the tile
Fixed when Blob or Squiggle x and y has been adjusted and points is set
was jumping to x and y of 0,0 - noticed when adding points after x and y is set.
Fixed List when being used with group for Style
was calling Window with wrong number of parameters with fullSizeColor added
Fixed Accessibility on resetting tabOrder was losing Highlight
This was because Aria was being turned on thus hiding Highlight so there is not two highlights
Well, NVDA needs Highlight so just took that test out - thanks Nathan for the report.
Fixed Pen clear() - was not clearing if only one layer - took test out and seems to work fine.
Tested in Gen-Pen as well - all is good.
Adjusted allowDefault of Frame to work fully as property - get set worked but rest was using parameter
Also added allowDefault test for auto scrollX(0) and scrollY(0) on Frame in full, fit and outside modes
PATCHED PHYSICS 2.0
Added pause(type) method to Physics so physics.pause() will pause and physics.pause(false) will unpause
Also added a read-only paused property - thanks Shan Ruan for the prompting
and a read/write timeStep property that if set to 0 will pause with normal being 1/physics.step
The timestep property in theory could be animated to change the speed of the physics
ZIM SHIM
https://zimjs.com/animate/
The ZIM Shim ZIM has been updated with ZIM 10.8.0 in its template js file
This includes an update to 10.8.0 that captures the frame.x and frame.y on window resize
when published as responsive. This properly positions TextArea and Tag.
Thanks Shauna B. for the report.
SITE
The CDN has a new page at https://zimjs.com/cdn/
ZIM Explore has a new page at https://zimjs.com/explore/
These were added because the auto directory functionality of the site has been turned off
UPDATED
CDN, Code Page, Distill, Bubbling, Slack, NPM, TypeScript, Templates,
Still to come: Blog, Patreon, Social Media
ZIM 10.7.1
CLONE
Container and descendants of Container using ZIM VEE
now have an exact parameter for clone: clone(exact)
This defaults to false to let ZIM VEE (Pick) parameters operate
Set exact to true to clone an exact copy of the object.
See docs for Container, Circle, Rectangle, Triangle, Squiggle, Blob, Label, Tile, Beads
-------- example 1
A Circle is a descendant of a Container as are all ZIM shapes and components
The Circle uses ZIM VEE so it will continue to do so if it is cloned
const circle = new Circle(10, [blue, green]); // will be blue or green
circle.clone(); // will be blue or green - not necessarily the same as the original
circle.clone(true); // will be the same color as the original
-------- example 2
If a Container (or Tile) has a new Circle(10, [blue, green])
Then the original color(s) will be randomly blue or green
A clone will by default use the ZIM VEE [blue, green] and randomize the color(s) again
Setting exact to true will clone the original colors
--------
Warning: some styles may not be cloned exactly
For example, LabelOnPath does not use ZIM VEE - except through styles
so it cannot be cloned exactly if styles are applied.
Also remember duplicate() that clones and copies custom properties
duplicate now also has an exact parameter
ISPICK
Added an isPick() function to code module
Returns whether an object is a SPECIAL Pick literal
of type [], {min:val, max:val}, or function that returns a value
If any other object is passed to Pick, it just gets passed through
So in theory, all objects are in Pick literal format
but isPick() returns true if object operated on, not just passed through
This was used to let regular values be cloned if changed without needing clone(true) for exact
For instance, cloning a Label("hello") after its text property was changed to "goodbye"
Thanks Ami Hanya for the report
Note: cloning a Label(["yes", "no"]) and changing its text property to "maybe"
would result in a "yes" or "no" unless clone(true) for exact was used
GENERAL
Updated pos(), center() and centerReg() for objects and containers without bounds.
If you center an object without bounds then it will center the registration point at the center of the container.
If the container has no bounds then it will center the object around the container's registration point. (thanks Ami Hanya for prompting)
Fixed bug in animate series where if the same object is animated in another series it was keeping old defaults (thanks again Ami Hanya)
Fixed bug in animate - now can drag after animation has ended (unless explicitely using stopAnimate())
Fixed bug in frame dispose which now joins Container in properly disposing recursively - thanks Alfred Yim
Adjusted mouse() and noMouse() to remember last mouseChildren and reapply when swapping back and forth (patched ZIM 10.7.0)
Updated Label to remember original parameters for size, font, color, fontOptions
to handle dynamic parameters when cloned (in a Tile for instance) - text was already remembered
Fixed style on LabelLetters - was accidentally set to LabelOnArc
Fixed clone on ZIM Beads - was missing a parameter near the end...
Fixed ZIM shape clones getting radialGradient if radialGradient is applied - accidentally used linearGradient. The linearGradient setting was fine
PATCHED
Fixed animate() shape tween - in 10.7.1, 10.7.0 and 10.6.1 - thanks Lily Da Huang for the report.
Shape tween needs events turned on in animate - and the index number for the parameter changed after adding the rewindTime and rewindEase parameters
We have a big message warning us... but we missed it... will remember next time!
Fixed animate on a path which was going back to 0 when done. Thanks Shan Ruan for the report.
This happened when we added the startPercent and percent features.
The modulus is used... and when it is 100% that was being set to 0%
which is not wanted when going forward but would be wanted when going backwards - tricky...
Patched an issue when animating beads in a series.
We were delaying the first sequence by 20ms (since the dawn of time) but this messed up a 0ms sequence every once in a while.
So we adjusted that to not do the 20ms delay if the sequence delay is 0.
Probably good enough. But please check any 10.7.0 apps to make sure they are okay with the patch.
Fixed duplicate() to not duplicate the parent property as the clone does not actually have a parent to start (thanks Ami Hanya)
Fixed Squiggle and Blob to drop properly when registration point is changed
Updated ProgressBar() to place the circle bar on the circle - since the fixes to pos() - thanks Ami Hanya for the find
Updated Accessibility() to make sure dispose checks for tag outerHTML property - thanks for the graceful error handling HTML... and thanks Nathan for the report
Patched pos() to work properly within containers with flexible bounds after adding more than one object
This is tricky as the added object changes the bounds and then positioning was set - so now set bounds then release bounds.
Properly added size, font, color, fontOptions to ZIM VEE (Pick) values
Made Tabs work with group STYLE - was missing propert group assignment
Made Tabs, List and Tips work with center, centerReg, pos STYLE settings
These are functional styles so do not get inherited and were removed from inheritance objects
but inheritance objects were a reference to the Style objects rather than a copy
so these were being removed from styles before being applied - fixed.
Fixed Label with Pizzazz backing and padding
Fixed Organizer arrows which were causing highlight of adjusted buttons being lost
Was a fix in the Tabs button being copied - should not have overwritten tabInfo
Updated CreateJS 1.2.3 to stop flashing in Chrome on PC TouchScreen - thanks Ferudun Vural for the report
See https://github.com/CreateJS/EaselJS/issues/997?#issuecomment-569596403
Adjusted capturing frame.mouseX and frame.mouseY to work with Animate where the stage is already made - thanks Shana B.
Adjusted Tabs to handle delayPick style for colors and backgroundColors, etc.
Added childrenToBitmap() method to Container to turn its content into a Bitmap and place it inside the container
This will remove all the children and leave just the Bitmap as the container's content
Added an extra 200 last resize dispatch to catch stage dimension change when lots of processing in stage update
Implemented RadialMenu currentEnabled and currentSelected params - they got left out
Fixed Label maxSize param to accept style - thanks Cajoek!
Fixed the Ticker update when a second "full" mode Frame is made and window resized
UPDATED
CDN, Code Page, Templates, Distill, NPM, TypeScript, Slack, Blog, Social Media
ZIM 10.7.0
BEADS
Added a Beads() class to place a given number of objects along a path
ZIM VEE (Pick) values can be used to place random objects or a series of objects
See https://zimjs.com/ten/beads.html
PATHS - IMPROVEMENT
Added a Bezier() class to code module under classes
Thanks Ivo Wetzel - StackExchange
This adjusts points at a ratio (0-1) along a path
so that they are evenly distributed
Adjusted pointAlongCurve to use Bezier
This is used in various places like Squiggle, Blob and path animations
Added even parameter to pointAlongCurve to use modified Bezier if true
Adding points to path still uses unmodified Bezier for handle equations
Adjusted hitTestPath and animate drag on path to use even:true for interpolate
SQUIGGLE AND BLOB
IMPROVEMENT Added approximateBounds() method to make bounds on Squiggle and Blob
Thanks Paul West for the recent request - it was in the plans since we made hitTestPath - good to see it work!
Added ZIM VEE (Pick) to Squiggle color parameter and Blob color and borderColor parameters
Added command and exact parameters to Squiggle and Blob clone parameters
Added even parameter to Squiggle and Blob interpolate() method
IMPROVEMENT Made adding points more accurate - was missing additional point on calculation
Also doubled the accuracy in adding points
IMPROVEMENT Adjusted Blob so if interactive is false, it still allows a cursor - for instance if drag() is used
Weird situation... if a child is set to cursor="default" then parent cursor has no effect on child
but if the child is set to cursor=null - then parent cursor is used when over child
ANIMATE ON PATH - IMPROVEMENT
Added startPercent and percent properties to the props animate object
These work only when animating on a path (Squiggle or Blob)
For example: props:{path:new Blob().center(), startPercent:50, percent:20}
This would animate along blob starting at 50% and going to %70
loop and rewind works - but startPercent and percent are currently not supported with drag on path
startPercent - (default 0) set to a percent for where to start the target animating
ZIM Bead objects will be given a startPercent that matches their start percentage
percent - (default 100) how much percent to animate from the startPercent
by default, the target will travel once along the path from its start position (startPercent)
this can be less than the startPercent to make animation travel backwards on the path
the percent can also be bigger than 100 as well as less than 0
so a percent:300 will travel three times along the path - and then rewind if rewind is set
and a percent of -150 will travel one and half times backwards along the path from the startPercent
Also added localToGlobal support to extra properties like zoom and speed
DISPOSE - IMPROVEMENT
dispose was adjusted to recursively go through all descendants of Container
dispose on a Container now calls all custom dispose methods
this was causing too much recursion but a two-way check system has been put in place
Thanks Cajoek and Racheli Golan from Slack for the issue report
This should now properly dispose recursively and from containers and reduce memory load
It is rather wide-spread so let us know if you notice any issues
IMPROVEMENT - Added arrows as an option in the List Accordion object:
{menu:{...}, shade:true, dim:true, arrows:true} - thanks Christopher Browne for the request
made Slider Button and Bar follow expand STYLE on Slider
added index property to Tabs and List items
made Accessibility alwaysHighlight AHBorderPadding work properly
added rewindTime and rewindWait to sequence animation
Fixed animate with dynamic in a sequence - was losing waits and information transfers between tweens (1 day bug fix)
Removed ZIM VEE (Pick) on sequences for the extra parameters... zoom, fade, speed, layer. (already removed from regular tweens)
IMPROVEMENT Added mouse() and noMouse() methods to ZIM Methods
These are chainable shortcuts to setting mouseChildren and mouseEnabled properties
the noMouse() can be used to reduce processing on complex objects
PATCHED
Fixed Frame dispose so if the frame disposed is the zimDefaultFrame then it sets zimDefaultFrame to null
Otherwise, building a new Frame after was causing issues. Thanks Alfred Yim for the report.
Animate on sound was pausing sound when animate done so now do not pause target when target has pan property
Still might have that issue on pauseAnimate - would need to use property name other than paused for animate...
Let Label color, size, font, fontOptions pass through clone with values from before defaults are applied
this lets a label be cloned and take styles - will look into this technique for other Display Objects...
Fixed animate on a path which was going back to 0 when done. Thanks Shan Ruan for the report.
This happened when we added the startPercent and percent features.
The modulus is used... and when it is 100% that was being set to 0%
which is not wanted when going forward but would be wanted when going backwards - tricky...
Patched an issue when animating beads in a series.
We were delaying the first sequence by 20ms (since the dawn of time) but this messed up a 0ms sequence every once in a while.
So we adjusted that to not do the 20ms delay if the sequence delay is 0.
Probably good enough. But please check any 10.7.0 apps to make sure they are okay with the patch.
UPDATED
CDN, Code Page, Templates, Distill, TypeScript, Bubbling Vids, Examples, Slack, NPM, Blog, Social Media
ZIM 10.6.1
SITE UPDATES
Added intro page to Gold Bars
and link to intro page from Start ZIM buttons on Banner pages
Added a Learn JavaScript with Creative Coding page
Adjusted the ZIM TEN page to show all thumbnails
Adjusted the Marquee page to act as archive for promos
Added new promos to front page Marquee
Adjusted news page to show large panels of news features
such as ZIM TEN, Code Updates (here), Marquee, Bubbling,
Blog, Learn JavaScript, Patreon Community news and Twitter
LEARN JAVASCRIPT
https://zimjs.com/learnjavascript.html
Started a new Series now on Video 20 for learning JavaScript
This follows the lessons in ZIM Skool
The videos are about half an hour each
Please share if you know people who would like to code
in a colorful environment for left and right brain learners!
ZIM LOOP
loop now returns true by default - potential BREAKIMPROVEMENT This allows loop to more easily act like a gate:
var array = [0,0,0,1,0,0,0];
var pass = loop(array, function(val) {
if (val!=0) return false;
});
if (pass) zog("passed"); // by default loop returns true
else zog("failed"); // false inside loop gets assigned to pass
// above will log failed
ZIM ANIMATE - BREAKIMPROVEMENT
added rewindTime and rewindEase to animate() after rewindWait parameter
see - https://codepen.io/zimjs/pen/PooyqPe
Fixed resetTween() and replayTween() on objects that have been animated
so that they work with path animations
FRAME
added a global asset() function that references frame.asset()
So once assets are loaded asset("image.jpg").center(); will work
This is a direct reference to frame.asset("image.jpg")
GENERAL - IMPROVEMENT
Fixed TransformManager so persist works with Blob and Squiggle
This had been broken since work on Layer in 9.5.0
Fixed Emitter so removeFrom() will remove the particles as well
and then if we addTo(), center(), etc. we add particles back to emitter's parent
We should really emitter.dispose() as well if this is permanent
Added cache parameter to LabelLetters to cache the letters
Fixed Frame dispose() to add back zil events for window keyboard defaults
for scroll, page up, page down, mousewheel, etc.
Also added back the scrollbar for when it was removed with ZIM Frame.
Removed highlight rectangle in Accessibility when disposed - thanks Nathan for the report
PATCHED - ZIM 10.6.1 and 10.6.0 for SHIM - was giving stage not found error - needed shim.stage
thanks Nathan for the find
Updated the Organizer - was giving error due to changed button system in Tabs
Fixed spacing in Organizer if any of useAdd, usePosition, useRemove is true
Fixed dispose in Pen - was giving an error paper not defined - thanks Alfred Yim for the find
Fixed animate() series calculation for rewindTime... had transposed a ternary operation
Updated CDN, Code Page, GitHub, Docs, Distill, Slack, NPM, TypeScript and Templates
ZIM 10.6.0
ZIM MINIMAL TEMPLATE
The Code Page now has a minimal template - thanks Eric Noh for the suggestion
The original template is there too and either can be copied with the COPY button
DPAD COMPONENT MOBILE IMPROVEMENT
Added DPad() class - a round joy-stick-like controller to replace arrow keys on mobile
good for moving things around by passing the DPad into the MotionController
Adjusted MotionController type parameter to accept "DPad"
SEE https://zimjs.com/ten/dpad.html
RADIAL COMPONENTS
Added LabelOnArc() to put a ZIM Label on an arc (remember there is LabelOnPath as well)
Added Radial() and RadialMenu() classes
These make radial buttons similar to Tabs
The RadialMenu provides a hierarchy menu similar to List Accordion - but on rings
Adusted Hierarchy to be able to add extra properties in simple format
used in RadialMenu for adding styles to each radial
SEE https://zimjs.com/ten/radial.html
ANIMATING TEXT
Added LabelLetters() to break apart a Label into individual letter labels
This is handy for animating letters using animate with a series - also for kerning letters
SEE https://zimjs.com/ten/radial.html
HOLD
Added hold() and noHold() chainable methods
Similar to tap() but will call function when object is held for longer than a specified time
The time is handled with a setInterval at which point it checks if in same position
If it is in a different position then the user must let go and try a hold again to trigger hold
Hold must keep cursor within a certain distance (5px) and be held for a certain time (1500ms)
This can be used to replace shift, ctrl, etc. keys on mobile
HOLD ON BLOB AND SQUIGGLE MOBILE IMPROVEMENT
Added hold on Blob and Squiggle points to remove points
shift click still removes - but now hold on points will allow mobile users to remove points
SHAPE CHANGES
Added tiny API for Shape right on Shape (added 300 Bytes)
So the following can be chained right to the Shape object
This means we can do code like the following:
new Shape().s(red).ss(5).mt(100,100).lt(200,100).addTo().alp(.5);
There is no longer a need for the separate call to the graphics property
See https://www.createjs.com/docs/easeljs/classes/Graphics.html for definitions and parameters
NOTE: only the tiny API has been added to the Shape NOT moveTo() for instance...
mt() moveTo
lt() lineTo
a() arc
at() arcTo
bt() bezierCurveTo
qt() quadraticCurveTo
r() rect
cp() closePath
c() clear
f() beginFill
lf() beginLinearGradientFill
rf() beginRadialGradientFill
bf() beginBitmapFill
ef() endFill
ss() setStrokeStyle
sd() setStrokeDash
s() beginStroke
ls() beginLinearGradientStroke
rs() beginRadialGradientStroke
bs() beginBitmapStroke
es() endStroke
dr() drawRect
rr() drawRoundRect
rc() drawRoundRectComplex
dc() drawCircle
de() drawEllipse
dp() drawPolyStar
p() decodePath
POS
ZIM pos() now uses constants LEFT, RIGHT, CENTER, MIDDLE, TOP, BOTTOM see below
The parameters have been adjusted to (x, y, horizontal, vertical, etc.) BREAK
Use LEFT, RIGHT, CENTER, MIDDLE for horizontal (or true for legacy RIGHT)
Use TOP, BOTTOM, CENTER, MIDDLE for vertical (or true for legacy BOTTOM)
Docs have been updated to better describe pos()
See https://zimjs.com/positioning/
CONSTANTS
Added new constants: LEFT, RIGHT, CENTER, MIDDLE, TOP, BOTTOM, HORIZONTAL, VERTICAL, BOTH
These are equal to the lowercase strings - so align:LEFT is the same as align:"left"
Added these and the colors to the DOCS under the FRAME module
Also added TAU, DEG and RAD constants to the CODE module
If working in radians, TAU is equal to 2 radians (360).
This allows easy visualization of angles - TAU/2 is 180, TAU/4 is 90, etc.
DEG is 180/Math.PI so you multiply a radian value by DEG to get degrees.
RAD is Math.PI/180 so you multiply a degree value by RAD to get radians.
Math.sin(TAU/4); // sin of 90 degrees (1)
// is same as
Math.sin(90*RAD);
// is same as
Math.sin(90*Math.PI/180);
// and
Math.asin(1)*DEG; // is 90
GENERAL
IMPROVEMENT Updated ZIM Frame resize event. After a resize, Frame now checks immediately then every 50ms until the delay time is met.
The delay default has been changed 1000 on mobile to catch the unbelievable delay iOS has in reporting new screen size.
The delay is 30 on non-mobile which forces the 50ms delay check to 30 (or whatever the delay is if less than 30).
Thanks Drashya Gohil and Frank Los for reporting and testing - hopefully this is the last time this needs to be worked on.
Added a color property to LabelOnPath
IMPROVEMENT Fixed animate() to animate with just an object literal for the props - eg. circle.animate({x:500})
This used to be read as a ZIM DUO object and therefore not work unless a second parameter was added
So we would always add the time for instance: circle.animate({x:500}, time:1000) - even though that is default
Added a setDefault() method and isDefault read only property to ZIM Frame
The methods addTo(), center(), centerReg(), loc(), pos(), Ticker.add()
default to the stage of the first frame made
Use setDefault() to set a frame to the default frame
Previously (and still), you could use the undocumented zimDefaultFrame global variable
Updated Frame asset parameter and Frame.loadAssets() to handle sound with text after the filename extension
by dividing filename with ? and using first part. - Thanks Cajoek on Slack for the prompting!
Added "pressdrag" type to MotionController that makes target follow mouse when pressed on
this is different than "pressmove" which moves the target to wherever the mouse is pressed and then follows the mouse
Thanks Shan Yuan for the request!
PATCHES (patches are only in CDN, Docs and TypeScript - not GitHub or NPM until next version)
Quickly changed parameters for Radial, RadialMenu, List and Organizer
to this order: color, rollColor, selectedColor, selectedRollColor BREAK
This matches with tabs and Pad.
Fixed hold() - it was calling the callback even if the mouse moved - oops.
In the timeout we had used the event object's stageX and stageY when this was the original mousedown event object!
Also converted it to an interval that tests 10 times within the time span
to turn off the hold if the object is moved outside the designated distance
Also made this not work if there is no Frame - Frame provides the mouseX and mouseY
but if there is no Frame, it would not work.
This is important to provide the functionality of removing points on Squiggle and Blob on mobile even if Frame is not used
We did some testing here: https://zimjs.com/test/existingcanvas.html
We also added a frame property to the stage and made the Stage and StageGL create a partial zimDefaultFrame
This will allow circle().center(), for instance, to work
but the zimDefaultFrame will get overwritten if a real Frame is made afterwards - don't worry about it!
Please ignore createjs 1.2.2 and use createjs 1.2.3 instead - there was an issue with Firefox - thanks Paul West for the report
The information has been updated here too: https://github.com/CreateJS/EaselJS/issues/997#issuecomment-547051940
Patched animate() to fix unpausing animate with drag on path
This broke in 10.4.0 when a fix for moving the target on dragged path before dragging the target
Now both work! Yay. Complicated updates - see 10.6.0 messages in animate()
UPDATED - ZIM Code Page to ES6, GitHub, ZIM Templates, TypeScript, NPM, Distill, Bubbling Videos, Blog Posts
UPDATED - ZIM Tips and ZIM Skool to ES6
UPDATED - CreateJS to 1.2.3 with important changes to help Touch on Desktop - especially for educators
UPDATED - CDN URL to ThreeJS to https://zimjs.org/cdn/r109/three.min.js
and added OrbitControls that work with ZIM even if on own ThreeJS canvas https://zimjs.org/cdn/r109/OrbitControls.js
ZIM 10.5.5
Added ble() short chainable method to set blendMode (compositeOperation)
Added events parameter to end of Tile to capture change events on tile items
this receives an event object that has an item property of the item that caused the change event
Can be used on Tile with on("change") or change() methods
Fixed Dial to rotate better at limits - was using return - should have set to min and max
GitHub and NPM Updates for 10.5.4 patches - see 10.5.4 patches below
PATCHES (patches are only in CDN, Docs and TypeScript - not GitHub or NPM until next version)
Fixed MotionController pressmove to not jump to mouse y position if axis is only horizontal (and same for x with vertical)
Fixed a Shape() using hitTestRect, hitTestCircle, hitTestPath and hitTestReg in retina
Made Toggle swipe easier with a slower drag feel... 20 pixels in 200ms
Updated CDN, GitHub, NPM, TypeScript, Docs, Code page and Distill.
ZIM 10.5.4
ZIMIFY UPDATE - IMPROVEMENT
Adjusted zimify() to include localToGlobal(), globalToLocal() and localToLocal()
methods that retro-override CreateJS versions on MovieClip objects for instance
Now, interacting with the clips will work properly when working with Adobe Animate
Previously, there were issues with drag, transform, gesture, accessibility, etc.
due to stage scaling by Animate export
We recommended putting the MovieClip into a ZIM Container
This is no longer needed if we zimify with 10.5.4 or beyond in ZIM SHIM
Make sure to zimify the parent of the MovieClip as well - as that is a MovieClip too.
zimify(myClip);
zimify(myClip.parent); // this is the timeline MovieClip
ASYNC - IMPROVEMENT
Created a https://zimjs.org/cdn/jsonp.php script to help with API calls
Example: https://codepen.io/danzen/pen/gNKQYY
You can filter a plain JSON response through the jsonp script, for example, like so:
var api = "https://swapi.co/api/planets/10/?format=json";
async("https://zimjs.org/cdn/jsonp.php?api="+api+"&callback=async.getData", getData);
function getData(data) {
zog(data); // data will be the JSON parsed object
}
Note, the docs show the code for jsonp.php so you can make your own if desired
This is working with other people's APIs that are not JSONp format
See the docs for working with your own files - which does not need jsonp.php
GENERAL
Adjusted TextArea to scale properly within scaled container - thanks Bart Libert IMPROVEMENT
Remember if scaling after TextArea is made then will need to textArea.resize()
Changed all reversable parameters to reversible - thanks Michael Albers
BREAK Added onTop parameter to Window and therefore List - defaults true.
Set to false to not bring window or list to top of its container when dragging
Fixed zim animate() - to ensure multiple protects, loops or rewinds on the same target IMPROVEMENT
do not set mouseEnabled of the target to be false
animate sets mouseEnabled off for 70 ms at start and then sets to last setting
Well, a second concurrent animate was receiving the wrong last setting - this is fixed
PATCHES (patches are only in CDN, Docs and TypeScript - not GitHub or NPM until next version)
Added items2D and items2DCols for Tile to get read only 2D arrays - thanks Ami Hanya for request
Fixed up Pages to properly set up multiple pages - change from 10.5.3 caused glitch - 10.5.3 has been repatched
Also adjusted Marquee in 10.5.3 and 10.5.4 to add Pages to the holder which is shifted for the nav
Added decimals parameter to game module Timer - patched https://zimjs.org/cdn/game_2.2.js
Fixed hov() to not give error if object that has hov is removed from stage and rolled off
Fixed animate() start angle on path to match first point's angle when orient is true - potential BREAK but unlikely
Adjusted animate looping on drag on path with startPaused true - typo in code.
Adjusted percentComplete to start at correct angle if animating along a path and orient is true
Added margin parameter at end of Container and Shape cache() method parameters that expands or contracts the cache dimension
This will also be available on all subclasses of Container such as Rectangle, Blob, etc.
Fixed TextArea in scaled containers in Retina - thanks Bart Libert for the prompting
Fixed drag on path when no animation - so object stays on path if path is user adusted and object had not been dragged yet
did this by running the drag ticker even before dragged set mouseCheck to true
as well as introduced an immediateCheck to percentComplete so setting percentComplete updates pathPercent
Fixed dragging on path after shape animating path or updating path with code and update() - use a zimAnimateChanged property on path
was already working when manually dragging path as that called a change event which animate() used to update segment ratios
Updated Code page, Docs, GitHub, CDN, Templates, TypeScript, SHIM, NPM, MVC files
Updated CreateJS to https://zimjs.org/cdn/1.2.1/createjs_min.js and NPM vesion
to include broken-image flow-through to ZIM 10.5.3 and beyond
ZIM 10.5.3
FRAME MOUSE POSITION (for Retina) IMPROVEMENT
Officially added ZIM Frame mouseX and mouseY properties
to capture mouse position including stage scale due to ZIM Retina
At any time this can be accessed as frame.mouseX and frame.mouseY
A stagemousemove event is used to get these values
This can be turned off with the new Frame captureMouse parameter (default is true)
Or by setting frame.off("stagemousemove", frame.mouseEvent);
Any mouse event object can still capture stageX and stageY
but will need to divide these by stage.scaleX and stage.scaleY for Retina
Note: stage.mouseX and stage.mouseY should not be used
as these did not work on touch screen - if using them, they should be divided by stage scale as well
Also note the mouseMoveOutside parameter of Frame to capture rawX and rawY as frame.mouseX and frame.mouseY
ACCESSIBILITY - APPLICATION ROLE IMPROVEMENT
Changed Accessibility to default to role of application rather than button
for ZIM objects other than TextArea, Loader, Dial, Slider, Stepper or Picker
This works better on NVDA screen readers as it forces "forms" mode
Thanks Nathan and Fiona for the report and debug help
Left the default of button for mobile.
Accessibility has a new application parameter (default true)
This goes after the frame parameter BREAK for any param after (highlights)
The application parameter can be set to false to make the default role a button (like before)
GENERAL
SVGContainer now has showControls and interactive parameters
to set all Squiggle, Blob and Rectangle, Circle transforms to these values
Thanks Andi Erni for the request
Updated ZIM SHIM to include 10.5.3 but also fixed reference to frame.canvas
that was missing in 10.5.2 (patched it) and patched this version 10.5.3
PATCHED
Adjusted Frame tag mode for dimensioned frame with Retina to accomodate % width style
See: https://zimjs.com/templates/tag2.html This needs to be in first stylesheet
Retina sets the width style which was overwriting any preset width style
So, the original style percentage needs to be applied first then the Retina scale
so it is a couple computated values - for a % height setting... use Frame retina:false
or request a calculation for % height on the ZIM Slack forum.
Added backgroundColor property to Label to get or set background color
Also made it so backgroundColor operates on a custom backing if there is one (Thanks Andi Erni for the thought)
Adjusted Pages so it works better with a holder and removes pages if transition "none"
Thanks Mike Gossland for the find!
Patched cdn/1.2.0/createjs_min.js to let broken image urls come through without console error
Patched ZIM 10.5.3 to convert these to broken image icons if used
Fixed animate() sequenceCall to go at ends of sequences and call at very end of all
Made Label change backing with width and height styles - so can use this to change backing width
Made Slider accept shadowBlur and shadowColor styles (for its button)
Adjusted physics_2.0 and physics_2.1 so follow bounds works with non-centered backgrounds ;-)
Created physics_2.2 with better LeaderBoard default font settings to match retina
Added an accordionIndex property to List to give the selected item's index inside an accordion
This was needed to handle repeated labels inside accordion lists - will be null if no accordion
If non-accordion lists have repeated labels, just use the selectedIndex
Note - selectedIndex of an accordion is only the index of the items that are showing
Added callEvent parameter to Pane hide() that calls "close" event when pane is hidden with method
This can be handy to use traditional close event with mouse
but then call hide() also with enter key for instance to call the same close event that was set for mouse.
Updated the CDN, Docs, GitHub, Code page, TypeScript, NPM, Tips, Templates, Distill
Come hang out with us on Slack https://zimjs.com/slack/
ZIM 10.5.2
FOLLOW
https://zimjs.com/ten/follow.html - with keys
https://codepen.io/danzen/pen/gNKQYY - with press
Added follow() method to ZIM Frame - works like follow() in physics - thanks John Smith for the request
but can follow any DisplayObject inside a Container - not just on stage
Added a followBoundary property to Frame to update the follow boundary in a "resize" event if frame is in "full" mode
With physics we were generally forced to make follow move the stage
but here we can add the object to a container and make the container move rather than the stage
this is a little more conventional as traditionally, the stage does not move.
Added a motionController property to any target being controlled by a ZIM MotionController
this is used internally by ZIM for follow - but could be generally useful.
Added a "follow" value for ZIM MotionController type parameter that keeps obj moving towards pressed position
GENERAL
IMPROVEMENT - adjusted ZIM MotionController so does not test for object beneath mouse if there are no mouseDownIncludes
this was lagging when there are thousands of objects on the stage and was unnecessarily
IMPROVEMENT - adjusted hitTests for Point, Reg, Rect, Circle and Path to use a slightly different calculation
for Bitmaps and Sprites versus all other DisplayObjects
The latter divides by stage scale where the former does not. (patched 10.5.0 and 10.5.1)
Changed a few timeout() and mobile() calls to zim.timeout() and zim.mobile() for zns=true setting - thanks Alfred Yim for the report
Fixed TransformManager and Transform to properly record last selected if not moved and not flash transform (since 9.5.0 Layer code)
Tested to make sure there is a titleBar before setting titleBarPosition in Layer
IMPROVEMENT - fixed ZIM animate() series so relative setting uses calculated values
Was using last actual target value and this was compounding a slight timing/value error
Now, for instance, if wait is added to series, resting place matches desired values exactly
see https://zimjs.com/codepen/triangles.html and source for comments...
Patched physics_2.0.js to include a frame property (thanks James Barrett for the request)
now physics can be transferred from frame to frame IMPROVEMENT
the drag() method will need to be reset each time
See https://zimjs.com/expand/physics.html for an example
where we go from a tag mode to a fit mode and change the frame of the physics object
PATCHED - added frame.update() to call when a Frame changes position relative to Browser window
for instance if a div to the left has its display set to none then call frame.update();
This will dispatch update events that Loader, TextArea and Tag object receive so they resize()
with the proper frame.x and frame.y - thanks Alfred Yim for reporting the issue!
Also added frame properties to Loader, TextArea and Tag - if changing frames, set this to the new frame
Added frame.mouseX and frame.mouseY - that include scale fix for ZIM Retina
Use these to avoid e.stageX/stage.scaleX and e.stageY/stage.scaleY
Also added mouseMoveOutside parameter to Frame at end of params before shim
Changed default mouseover rollPerSecond from 10 to 20 - the CreateJS default.
Adjusted https://zimjs.org/cdn/three_2.0.js to work with ZIM in tag mode
Needed to set ThreeJS canvas to position absolute with left and right set to 0px - thanks Yalon for the report
Updated: CDN, Docs, Updates, Distill, GitHub, TypeScript, Code Page, Templates, NPM, TIPS
ZIM 10.5.1
Added hardKeyboard parameter (default true) to Keyboard IMPROVEMENT
to accept regular keys being pressed and changing selected label
Fixed bug in going to second label (also patched 10.5.0)
Added endTween() to animate() target to jump right to end of animation and set end properties - thanks Ami Hanya for the idea.
This compliments resetTween() and replayTween() which have been recently added to animate() targets as well
BREAK - changed Indicator press parameter to interactive to consolidate terms.
IMPROVEMENT Fixed StageGL (Frame with gpu:true) to work with retina (patched 10.5.0 as well)
Also tidied up stage resize on full in gpu:true so it does not flash with retina turned on (ZIM 10 fix caused this)
ZIM SHIM 2 IMPROVEMENT
https://zimjs.com/animate.html
Updated ZIM SHIM to work with ZIM 10.5.1 and beyond - thanks Amy Rule for the prompting
ZIM SHIM now creates a full frame object rather than a simple surrogate frame.
This allows ZIM objects relying on Frame resize (TextArea, Loader, etc) to work in Animate
Also a few other ZIM objects used Frame methods, properties and events that were missing.
Added shim parameter to frame (default null) to handle making a full Frame when the canvas and stage are already made
This accepts an object with stage and canvas properties and lets Adobe handle resize
ZIM 10.5.0
CDN UPDATE
https://zimjs.org/cdn/
Changed the CDN to zimjs.org/cdn/ with a new naming format
The Amazon d309knd7es5f10.cloudfront.net url still works for OLDER versions of ZIM
The new naming format uses the directory to keep track of ZIM versions
The file names will remain constant as zim.js for minified and zim_doc.js for full
So the two main libraries are at:
https://zimjs.org/cdn/1.2.0/createjs_min.js
https://zimjs.org/cdn/10.5.0/zim.js
You are welcome to use these or download versions to your own servers
The latest helper libraries have been moved to the new CDN as well
See the top of the Docs pages for links
Explanation: as we move into more than a million views a week amazon was costing money
zimjs.org uses CloudFlare which caches the files at the front edge of the internet cloud!
Many other js libraries use CloudFlare too at https://cloudflare.com
MARQUEE
https://zimjs.com/marquee.html
Added a Marquee component to cycle through images and interactive works
Uses ZIM Pages and Indicator objects - and a pause/play button
Can show ZIM interactive works in banner area!
Docs can be found near the bottom of Components
LIST PULLDOWN IMPROVEMENT
https://zimjs.com/ten/pulldown.html
Added pulldown parameter to List
which prepares the list to take a height based on a number of items
It also hides the background and border
Setting this with accordion can expand and contract the list like a pulldown
Added open property to List accordion object that starts an accordion open
LIST ITEMS
https://zimjs.com/explore/pulldown.html
Created special List items: Slider, CheckBox, ColorPicker (for now)
These are created as List.slider(), List.checkBox(), List.colorPicker()
and can be combined with the pulldown arrangement to make a collapsible control panel
DOT ANIMATE
Updated CreateJS version to include the new TweenJS dot plugin
https://zimjs.org/cdn/1.2.0/createjs_min.js
This allows animation of properties within properties by using quoted values for the property name
so props:{"rotation.x":200} for instance
Updated dozens of property assignments within animate() to handle dot property values
Note, TweenJS requires an initial . at the start props:{".rotation.x":200}
but that is not easy to remember so ZIM allows for both notations.
TweenJS also added a plugin for relative animation using "" - ZIM already has that
the TweenJS version requires a + or - at the start. ZIM does not require the +
Unfortunately, the dot plugin requires the TweenJS version
So we have made ZIM convert any relative without a + to having a +
which means, we are good to go with or without the + for relative animation
props:{".rotation.x":"30"} or props:{".rotation.x":"+30"} will both work
REPLAY TWEEN IMPROVEMENT
Added resetTween() and replayTween() methods to objects with tweens
These will set the object to the tweened property values before the tween started
and replay the tween - re-runs the animate() with the same parameters as the last tween
Added a clean parameter to animate() that will not clear the tween ids when tween ends
the idea being percentComplete will still work - but unfortunately, it does not include the wait time
so replayTween() was added if the initial wait time is desired
GENERAL
Added makeIcon() to Frame to make the ZIM TEN Z icon (360 byte customizable vector)
Added animateReturn() method on target of animate()
that works when animating on path to return target to the start if rewind is set to true
IMPROVEMENT - fixed Blob and Squiggle due to change in center() and centerReg() - was shifting points
IMPROVEMENT - Fixed Slider to capture stage variable when track is pressed - was needing button pressed first since Retina
Fixed negative sign on list hierarchy - it was shifting too low on retina
Fixed Dynamo and Accelerator pause to not break if paused the same way twice - it now ignores the second time
Made Dynamo remember change in percentSpeed when paused so unpausing is at new speed
Added read/write sensitivity property to ZIM Swiper
Added conversion from rgb() and rgba() to hex and string to convertColor() - thanks Ikki for reminding us!
also made conversion to string output hex number if no matching string color
Fixed Label center on backing - had removed code there for some reason in 10.3.0 - look back and see why
Also tidied up bounds of label with scaled backing - thanks Bart Libert for the report
Fixed hitTestPoint, hitTestReg, hitTestRect and hitTestCircles to work properly with Retina - thanks again Bart Libert
Made ColorPicker force upperCase for selectedColor
Fixed List indenting issue with align left or right with both custom and label items
Added checkBox parameter to styles for List
Adjusted animate() sequence to work properly with pauseAnimate()
previously, the sequence was run by timeouts initially that were not part of the pauseAnimate system
so startPaused:true for instance would let the timeouts run
and the sequence would run all at the same time when pauseAnimate(false) was called.
So changed sequence to use wait animation and then wait again if a wait was in the sequence
this ties sequence into the animation chain from the start
IMPROVEMENT Adjusted ZIM Label to better work with ZIM Retina.
The stage scale was affecting the placement of createjs and perhaps canvas text relative to bounds
Reworked how the Label centers and positions as well as on backing and backgrounds
Changed Tabs and Stepper to center label
Adjusted docs on Label to read the correct "top" as valign default
ZIM strays from HTML tables on this with a default left and top alignment for text
However for Buttons, etc. the default is center
Buttons support ZIM VEE (Pick / zik) on main colors - see docs
This was primarily for alternating colors on Lists for instance
PATCHED - added getColorAt(x,y) method to a Bitmap that returns the rgba() at the x, y location
Fixed dispose for Window with interactive false - was giving a Ticker remove warning - thanks Frank Los
Fixed setMask() to work properly with Triangles - changed the code to work with all situations
Fixed StageGL (Frame with gpu:true) to work with retina
Also tidied up ZIM 10 fix so stage resize on full in gpu:true does not flash with retina turned on
Adjusted hitTests for Point, Reg, Rect, Circle and Path to use a slightly different calculation
for Bitmaps and Sprites versus all other DisplayObjects.
UPDATED: CDN, Docs, Updates ;-), Code Page, Templates, Distill, TEN page, TypeScript, GITHUB and NPM
ADJUSTED: docs text version, view code, zoo, distill to work with new CDN
ZIM 10.4.1
Added an immediate parameter to ZIM timeout pause() method - works when unpausing.
Added reset parameter to ZIM interval and timeout pause() methods
This comes after the immediate parameter.
If both these are set to false (defaults) then unpausing will run the time left after the pause
The immediate true will unpause and run immediately.
The reset true will unpause with the full interval time left.
Also fixed paused(false) so that if already running it will clear the last interval
In animate(), moved relative property assignment to after the wait - thanks Yalon for the prompting
This means that relative values ie. props:{x:"100"} will work better in animate series.
They will be relative to the end of the last animation rather than relative to the value at the start of the series
Fixed dashed on Button border to work - lost it when separating border from background to handle shadow better
Adjusted Pages so it adds pages to the provided holder
Adjusted Pages so addPage and removePage changes pages array property
Updated ZIM Workshops to 10.4.0 - https://zimjs.com/teach.html
ZIM WS - Canvas
ZIM WS - Coding
ZIM WS - Game
ZIM WS - Asteroids
ZIM WS - Meme
ZIM WS - Physics - TODO
PATCH:
ZIM windowWidth() and windowHeight() have been adjusted to take into account Chrome on iOS
which was not reporting a change on orientation - thanks Ross Isenegger for the catch
This meant orientation was not triggering properly as we used the width and height to determine orientation
There was also an issue with delay still not catching some resize values
We have implemented a three step process for mobile:
On resize, dimensions are checked [1] right away and [2] at 30ms automatically.
There is also a delay parameter that has a default of 50ms
so an additional check will be done [3] at 50ms or at whatever this parameter is set
Setting the delay to 0 would turn off checks [2] and [3]
Adjusted hitTests for Point, Reg, Rect, Circle and Path to use a slightly different calculation
for Bitmaps and Sprites versus all other DisplayObjects.
Updated ZIM CodePen Examples on Examples page
Rocket, Zdog, GitHub stars, Tiles, etc.
Updated CDN, GitHub, Code Page, Templates, NPM, Distill, TypeScript (no changes), Slack
ZIM 10.4.0
TEN PAGE
https://zimjs.com/ten.html
Updated TEN page to show links to various updates to ZIM TEN
LIST WITH CHECKBOX
https://zimjs.com/ten/listcheckbox.html
Added checkBox parameter to List to use checkboxes in list - thanks Dale789 for the prompting!
Added checkBoxes property to List to give a read only array of checkBoxes
Added a checkBox property to a list item like list.selected.checkBox to give access to an item checkBox
Added the following three methods to manipulate checkBoxes:
setCheck(index, type) - set the CheckBox at an index to true or false (the type parameter)
setChecks(type) - set all CheckBoxes to true or false (the type parameter) returns object for chaining
getCheck(index) - get the checked value of the CheckBox at an index
Added tap parameter to CheckBox to activate on tap - good for List and Window when dragging
Added toggle(type) to CheckBox and toggled property - same as setChecked and checked but consistent with others
PATH TRAVERSE
https://zimjs.com/ten/traverse.html
Added a traverse() method to Blob and Squiggle to animate an object between points of the path
Added a "traversed" event that is dispatched when a traverse() ends
To traverse backwards past start or forward past end of Blob use two traverse calls
Thanks KV for the experimentation and requests.
IMPROVEMENT Fixed up animate() along path so it properly resets internal pathRatio and tween with stopAnimate() called
this is important when doing multiple animations along path.
Set this to reset only with path or dynamic animation - watch out for color animation
Color seems to work but may have issues with multiple color animations on same object
THREE - RETINA - IMPROVEMENT
ZIM three_2.0.js has launched to work with retina
The namespace is now optional and works like new Three();
See https://codepen.io/zimjs/pen/qGPVqO
PIZZAZZ 3 - RETINA - IMPROVEMENT
Adjusted pizzazz_03 to work with retina
https://zimjs.com/patterns.html
Tidied up setMask() for retina - was not working if mask had same parent as object.
This fixed the ProgressBar() in retina
This is an odd localToLocal issue since retina - we will keep an eye on it.
ANIMATE REPLAY TWEEN - PATCH
Added a clean parameter to animate() that can be set to false to not delete the tween when done
This allows percentComplete to be adjusted and target.pauseAnimate(false) to play tween
Note - percentComplete does not include waited once waited period has passed
So to restart a tween that has a wait use replayTween - see below.
Added target resetTween() and replayTween()
resetTween() will reset the properties of the target to the original values before the last tween
replayTween() will reset the properties and play the last tween
Note - only replays the last tween of a series and probably does not work on sequence animation
GENERAL
Fixed zta() so it does not break in IE11 - as there is no console.table()
PATCHES
Patched animate() in series mode to make sure last animate object call is called - thanks Yalon for the find
Patched animate() series to remove first animation in animate series when a wait is present
this was causing subsequent series animations to not have the correct idSet id for stopping
Made animate() override any paused properties so not unpausing Sprites to cause CreateJS Sprite animation
Tested animation page and NIO dynamic animations
BREAK - adjusted centerReg() and center() to center on the origin of a container that has no bounds set
Made Label() text parameter accept ZIM PICK object
Fixed Pane() close if no stage to update
BREAK fixed width and height, widthOnly and heightOnly to be absolute value (positive) if scale is negative (strange we missed this for so long!)
Fixed Tile() mirrorH and mirrorV and align, valign with scaled objects
Fixed Frame() loadAssets queue version of "assetload" event - there was a typo in the event dispatch - working now...
Added a controls property to transformControls that references the controls
Added data parameter to Loader save() method - set to true to return Base64 string instead of file saving image - thanks Ami Hanya
Adjusted Circle, Rectangle, Triangle, Squiggle and Blob to clone gradients (when using direct linearGradient() and radialGradient() methods)
Fixed Keyboard < > x vertical spacing
Fixed Keyboard cursor placement - was using globalToLocal on CreateJS Text field - which is broken in retina
Fixed Label backing so that pattern gets saved under backing property and properly centered when label is centered
Also removed stage scale setting in Pizzazz 3 that was incorrectly added to retina
Updated ZIM Docs, Code page, Distill, Bubbling Videos, Templates, GitHub, NPM, TypeScript
Updated GitHub ReadMe intro page - please STAR us on GitHub if you can - thanks - we are trying to build awareness.
Whew - thank goodness for Patreon! https://www.patreon.com/zimjs - never any pressure - using ZIM is the biggest reward!
ZIM 10.3.1
Added strokeObj parameter to ZIM Shapes Circle, Rectangle, Triangle, Blob, Squiggle
which defaults to {caps:"butt", joints:"miter", miterLimit:10, ignoreScale:false}
https://zimjs.com/explore/strokes.html
Added radialGradient() and linearGradient() methods to Circle, Rectangle, Triangle, Blob
These just call the colorCommand versions which are still there
Note - must update about 100 Rectangle, Circle and Triangle occurences in ZIM otherwise get a recursive style error in group style
Note - to apply gradients to the border use the borderColorCommand (we do this less often)
IMPROVEMENT Fixed setMask on ZIM shapes to handle masking objects in non 0,0, scaled and rotated containers
Note: getConcatenatedMatrix().decompose() must have scales divided by stage scale in retina setting
Cloned label backing from STYLE so can set same backing on multiple labels - thanks Valeria Valoueva for the prompting
Added still parameter to reg() to set x and y so object does not move when reg is set - thanks Vishwas Gagrani for suggestion
Fixed up missing parameters at end of Blob and Squiggle clone
IMPROVEMENT Removed extra space at end of List when removeAt() is used
IMPROVEMENT Fixed up List accordion setting indent glitch since 10.0.1 - thanks Alicia Martin for the find
We had added a backing rectangle for the list elements and this broke indenting after a second time (put a backing on a backing!)
Added shiftHorizontal and shiftVertical to STYLE of Button - goes through to the label parameters...
Updated CDN, Distill, TypeScript, NPM, Templates, Code Page, Docs
ZIM 10.3.0
RETINA - IMPROVEMENT
https://zimjs.com/retina.html
Added a retina parameter (default true) to scale the stage with devicePixelRatio
Scaling the stage rather than the canvas works very well for scaling vectors up
This is the technique that Adobe Animate uses - see the next section for issues.
ADOBE ANIMATE - IMPROVEMENT
https://zimjs.com/animate.html
ZIM now provides a ZIM SHIM that lets ZIM work within Adobe Animate without ZIM Frame.
This is a standard Animate Publishing template with a few lines of ZIM code added.
ZIM was mostly supported in Animate but now, various issues below have been solved.
Adobe Animate scales the stage - which affects globalToLocal, localToGlobal, localToLocal.
ZIM now overrides these with fixes and dozens of changes have been made as follows:
1. Basically localToGlobal needs its resulting point to be divided by the stage scaleX and scaleY.
globalToLocal needs its input point multiplied by the stage scaleX and scaleY
localToLocal needs to call these - but not the GlobalToLocal if the object is on the stage directly - sigh.
2. BREAK Mouse even object e.stageX, e.stageY, e.rawX, e.rawY need to be divided by the stage scaleX and scaleY.
3. stage.getObjectUnderPoint() needs to use the x and y multiplied by stage scale
unless you are using e.stageX and e.stageY which would normally be divided by stage scale
so the result is you can pass e.stageX and e.stageY directly in to getObjectUnderPoint without any changes
4. Adjusted scaleTo() to assume stage is scale of 1 with stage.width and stage.height matching what is set.
5. Shapes are still positioned as if on an unscaled stage for hitTests.
So any x and y values need to be multiplied by the stage scale before doing a globalToLocal
into the shape to counter the globalToLocal expecting a 1 scale stage.
6. getConcatenatedMatrix() needs to have resulting values divided by stage scale
OTHER ADOBE ISSUES
7. The CreateJS MovieClip does not have the ZIM fixes to globalToLocal, localToGlobal and localToLocal
So create a ZIM Container with bounds of the MovieClip and add the MovieClip to the container.
From then on, use the ZIM Container to drag, transform, hitTest, etc.
8. Adobe Animate is running an older version of CreateJS that does not automatically recalculate (previously specified) bounds when set to null.
This causes Tab heights to miscalculate which effects List, etc.
So adjusted Tabs to test for old CreateJS and not expect bound recalculation.
9. There seems to be a problem with hitArea (expand()) on cached objects so adjusted use one or the other
SQUIGGLE AND BLOB PATH - IMPROVEMENT
https://zimjs.com/hittestpath.html
More updates to path control to help out with Shape Tween which was launched in 10.2.0:
1. Added addPoint(), addPoints() and interpolate() methods to squiggle and blob
To add a point at a percentage, or add a number of points between points
Or get the data for any number of points - used by hitTestPoint
interpolate could be used to set dynamic bounds on Blob and Squiggle
which would lead to setting a drag Boundary - like the general drag() has.
So look for this in future versions of ZIM.
2. We could shape tween between shapes with a different number of points
but for now, use the addPoint() manually so the number of points are equal.
This will usually result in better shape tweens than trying to guess where to automatically add a point.
But we may look into how that might be done via an algorithm.
3. Added hitTestPoint(num) to do a hitTest of any object shape along a Squiggle or Blob path!
4. Adjusted the editPoints parameter so true adds points only to the edge.
Followed this amazing interactive tutorial - thanks Gabi
https://codepen.io/enxaneta/post/how-to-add-a-point-to-an-svg-path
When we do, it adds the point and adjusts the points next to it - for no overall path adjustment.
Thanks Sam Van Herck for the promptings.
If you want the original adding points anywhere - use editPoints:"anywhere"
At which point, it adds a point with controlType "none".
Added two properties to adjust accuracy vs. speed of adding points:
addPointFactor - (default 20) used when placing new points along edge (editPoints is true)
divides the distance between points by this amount - the smaller the more accurate but also slower
addMinDistance - (default 15) edge press needs to be within this distance to add a point to the edge
GENERAL
Added offStage parameter to drag() - set to true to be able to drag the object off stage - thanks Shammi for the idea!
Adjusted Stage and StageGL to accept a canvas tag as well as the traditional canvas tag ID.
Added rgb and rgba support to ColorPicker - thanks Ami Hanya for the promptings
The rgba alpha now adds a start alpha for startBackgroundColor - if rgba is used in a color list the alpha is ignored
Added rectIntersect(a,b,margin) function to code module which returns true if rectangles intersect
Added boundsAroundPoints(points) function to code module to get a rectangle around an array of points
These are used by Blob and Squiggle and hitTestPath
Fixed Blob "circle", "rectangle", "triangle" points parameter values to use radius setting as well.
Fixed "rectangle" to be centerReg() for Blob IMPROVEMENT
Fixed slight spacing issue with hitTestGrid() IMPROVEMENT
Undecided how to treat setting bounds width or height to 0
it means that width and height can't be set as they adjust the scale and we divide by 0
So adjusted Tabs to overwrite the width if width is 0
Added blur event to Window to stop drag if browser window loses focus - thanks Ami Hanya
To turn this on, set the List or Window cancelCurrentDrag parameter to true
Seems that maybe mobile was not handling transform controls properly due to getObjectUnderPoint test IMPROVEMENT
So removed this requirement for mobile - means objects overlayed on transforms may trigger transforms on
This was a rare issue and more of a perfectionist fix...
The getObjectUnderPoint is working in a simple case on mobile but not in the complexities of transform().
Adjusted drag() slidestop event to not trigger if object is just clicked on and has not been moved - thanks Frank Los for the report.
PATCHES - added support for receiving SVG path format in the ZIM Squiggle and Blob points parameter
Adjusted animate() drag for path with Squiggle and Blob according to the technique found here https://codepen.io/eliCrow/pen/MLdddR
See the ZIM version: https://codepen.io/zimjs/pen/GLLvoP
automatically set ease to "linear" when dragging on Blob or Squiggle - it is the only ease setting that works
fixed TextArea, Tag and Loader to scale and place properly with retina - CreateJS DOMElement was scaling the tags when the stage scaled
Tried to fix the outline property of Label - since it is a CreateJS object, the localToGlobal is off - may have to recode for exotic label settings
Fixed Label outline parameter to work with labelWidth and labelHeight set - thanks Ami Hanya for pointing it out
Patched Timer in a few places for game_2.0 with respect to ending time
Updated SVGContainer to set splitTypes default false like the docs say
Made Waiter dispose() remove waiter from stage - thanks Ami Hanya
Fixed up Distill to work with centering with STYLE - zob() in distill needs to be kept up-to-date (was missing something we added for STYLE and ZIMON)
Fixed Pick class to properly work with Distill - needed to record static methods being used
Changed obj.setBounds() to obj._bounds = null; to support pre version 1 CreateJS code (like current Animate export)
Updated CDN, GitHub, Distill, Code page, Templates, TypeScript, NPM, Bubbling vids, Site, Tips, Social Media, Blog, Promo Ads.
ZIM 10.2.0
ZIMON
See https://zimjs.com/zimon/
Similar to JSON, ZIMON stands for ZIM Object Notation
It turns any object to a string using ZIMON.stringify(object)
It turns a ZIMON string back into and object using ZIMON.parse(string)
The object can be on its own or inside an array [] or an object literal {}
These can be nested and filled with any type of object (that is prepared**)
** ZIMONON (default false) must be set to true to properly ZIMON.stringify()
this prevents the slight memory cost if not using ZIMON (95% of the time)
KEY
An optional key object can be used to specify the scope of the class
and to specify which properties to store for objects made from a class.
The scope must be a string accessible from where you stringify - it can contain dots (.)
The key can be passed as the second parameter to ZIMON.stringify().
The key is sent in the ZIMON string and nothing extra is needed when parsing.
PURPOSE
The purpose is similar to JSON - to save to localStorage or databases or share between languages.
Indeed, the final ZIMOM format is JSON.
Like JSON, ZIMON can be used outside of ZIM and outside JavaScript if implemented in another language.
See https://github.com/danzen/zimon/ for generic JS code to port to other languages.
** PREPARED OBJECTS
Any objects NOT supported by JSON must be prepared
so objects other than string, number, array, object literal, boolean or null
need to have the following:
1. A type property that matches the class name as a string
2. An arguments property that holds an array of the arguments passed to make the object
The ZIM Objects are already prepared - so no extra work is required
See ZIMON in use here in an updated version of https://zimjs.com/iso/
ZIMON - adjusted zob() to record arguments of any class when ZIMONON is true
SHAPE TWEEN IMPROVEMENT
See: https://zimjs.com/animation/shapetween.html
ZIM now supports built in animation from one Squiggle to another or one Blob to another
This is built in to animate() as a convenience property called shape:
squiggle.animate({shape:secondSquiggle}, 1000);
There is also a blobShift convenience property that cycles the target points (positive or negative)
blob.animate({shape:secondBlob, blobShift:2}, 1000);
The Blobs or Squiggles need to have the same number of points
BLOB BASIC SHAPES IMPROVEMENT
See: https://zimjs.com/animation/shapetween.html
ZIM Blobs points parameter now accepts shape values of "circle", "rectangle", "triangle"
or a custom ZIM Circle, Rectangle or Triangle object to match.
This makes it easier to shape tween, path animating/dragging/labelling, etc. with basic shapes
GENERAL
Added expand to STYLE functions
Adjusted animate to properly represent the percentComplete property on the target. IMPROVEMENT
This needed to be applied after animation starts to catch rewind percentage, etc.
See https://zimjs.com/explore/squigglepart.html
added a read-only adjusted property to Triangle as to what the adjust parameter was set at
IMPROVEMENT added {passive:false} to zil() events to avoid another Chrome protective console warning (sigh)
added a series type to series functions
noted that header('Content-type: text/javascript'); needs to be added to PHP calling async
again to avoid a new warning in Chrome console (sigh)
Fixed internal id number in SVGContainer to work properly with Distill
Fixed doc on LabelToPath so showPath is true to start
Fixed Toggle("ON") example to Toggle({label:"ON"})
and took away selected property - use text property instead as read-only what text is selected BREAKIMPROVEMENT Dozens of circle component parts were adjusted to accommodate new percent parameter in Circle
IMPROVEMENT Tidied up hov() mouseovers and cursor settings
Updated CDN, Templates, Distill, Code Page, TypeScript, NPM
Bubbling videos, blog post and social media coming soom
ZIM 10.1.0
ZIM TEN SITE
The ZIM TEN site is finished and has been well received.
A few logos on secondary pages are still the last ZIM logo.
We will get to those soon.
There were a few overlaps on Mobile - if you see anything, let us know at
https://zimjs.com/slack - thanks to Jade for catching the glitches!
GAME MODULE - VERSION 2
https://zimjs.com/iso/
Updated Game Module to 2.0 - and added the Game Module to bottom of Docs.
You still need to import (script tag) the game_2.0.js file to use.
Added Board(), Person(), Orb(), Tree(), Timer() and Scorer() classes.
They let you make tile games in top or isometric view.
A relatively comprehensive example is at https://zimjs.com/iso/
There is not much of a game there but it uses most of the parts.
This is somewhat based on https://zimjs.com/carboon/
which has NOT been updated to the new Game module - but shows potential.
IMPROVEMENT The Docs now include the GAME module at the bottom in purple.
The Board class is quite well featured with over 20 parameters and more than 60 properties and methods.
It is designed to optionally work with path finding such as EasyStar.
The board supports info that can be bigger than the board.
Then a camera can be moved with swiping or arrows.
Pieces can be moved around the board with keys or with pathfinding.
Advanced filters on data, color, icons, items and rows is available
for finding random tiles, keying to certain tiles, removing certain items, etc.
Game Module: PATCHED - LeaderBoard colors to match color being font and backgroundColor being shape. BREAK
Added backdrop to LeaderBoard that closes LeaderBoard if clicked off LeaderBoard
Added multiple domain support when signing up for LeaderBoard - just use commas between domains
CodePen is running pens on different domains so can try: cdpn.io,s.codepen.io for domain.
STYLE FOR CONTROLS IMPROVEMENT
STYLE has been added to Pages(), Layout(), Grid(), Guide(), Tile(), Pen(), Emitter(), Scroller(), and Dynamo()
Here is our test page: https://zimjs.com/test/styles.html
Also added loc functionality for STYLE in general
STYLE = {loc:10} // will put everything at 10 - or target type or group, etc.
STYLE = {loc:{x:10, y:10}} // will put everything at 10, 10
ZIM NPM
Added ZIM and CreateJS to NPM - Node Package Manager
Use with Browserify to make Browser ready
See https://zimjs.com/npm.html
ZIM MVC
Added a template for ZIM Model View Controller
See https://zimjs.com/mvc.html
GENERAL
Added duplicate() chainable method to clone() and copy any custom properties - thanks Ami Hanya for the suggestion
Fixed SVGContainer and Circle to show up properly when viewing the code from the Docs.
Added isometric swiping to Swipe as fourth parameter to work with Game Module Board({isometric:true})
Made hov() automatically set cur() and set cur("default") when hov(-1)
IMPROVEMENT Fixed pages jumping to left when going back to landscape on apple ipad - thanks Frank Los for prompting
Fixed physics when dispose() and go to make a new Physics()
Fixed Physics noDrag() when already dragging - thanks Ami Hanya for the prompting
Added index property to Pages - that gives the index of the current page in pages
fixed contact() to work on new physics when previous physics is disposed
will still need to reset contact() on new physics
BREAK - for Toggle(), removed toggle.selected and changed toggle.text to show selected text or "on", "off" if no Label
IMPROVEMENT Fixed cloning of Tile - was removing first object as we tried to let objects with ZIK clone with ZIK
Solution was to clone objects having a clone but not cloning ZIK objects.
Added loc to Distill custom select functions - caused it to be missing in customize feature for docs
This has been a large undertaking over the last month... well and five years.
Your support on Patreon at https://patreon.com/zimjs is always appreciated.
We were dinged for a $200 bill from Amazon with 5 Million views a day.
So we are thinking of moving the CDN to CloudFlare - we would keep the Amazon as well for legacy.
Also, if you have not left a review on FaceBook https://facebook.com/zimjs/
Or let us know on Slack at https://zimjs.com/slack
and we will post on the About page at https://zimjs.com/about
ZIM 10.0.1
PROTOTYPE CONTROL STYLES
Prototyping adding controls to STYLE - the first test is with Tile.
Added a delayPick style to let Tile choose the value rather than STYLE on the object
For instance, passing [red, green, blue] to a Circle would pick the color randomly
but adding a Circle to a tile gets only one styled circle - so the whole tile would be that random colored circle
Adding delayPick:true to the circle style will let the Control using the object make the selection
This will be handy for Emitter, Pen, etc.
Added a percent parameter to ZIM Circle that makes a Circle have a percent arc.
So new Circle({percent:50}) is a semi-circle with bounds of the semi-circle
The registration point stays the center of the circle
https://zimjs.com/explore/circleArcs.html
Added spin() method to Physics objects
this is a one-time turning force like an impulse is a one-time linear force
To apply a constant turning force, use torque() in a Ticker or keydown event, etc.
https://zimjs.com/explore/spin.html
Fixed Physics to work with scroll and follow using drag() - already was working with controls but not drag.
Added pointsAdjusted property to Squiggle and Blob to change rotated or scaled points to non-rotated and non-scaled
IMPROVEMENT Added normalize parameter to Squiggle and Blob update() method to update to normalized points
must do this after rotating or scaling a point and then expecting manual updates on points
otherwise if just animating rotation or scale of points do not need to set normalize true (just leave parameter out)
Fixed bounds of cloned scaled Bitmap - was cloning width and height rather than bounds.width and bounds.height - thanks Ami Hanya
Made Blob showControls param and method work when interactive false
IMPROVEMENT Fixed adding points to blob when showControls is false - it remakes blob and was using showControls parameter value rather than _controls dynamic value
Added faint background to custom Tabs and List elements so selected index works for whole tab area not just directly on the custom item - thanks Racheli Golan
https://zimjs.com/test/listAlign.html
Made Tabs and List align and valign work properly with objects that are not top left registration point - and handles align of scaled custom objects - thanks Ami Hanya
Fixed transformControls.update() to work after pos() - pos was using CreateJS getTransformedBounds() and that was setting some sort of matrix that mixed up transform
Fixed transformControls.update() to add controls on top of object - was going one back since 9.5 update...
Fixed pressup on controls to remove custom cursors - lost a stage.update() somewhen.
Adjusted Guide to show pixels on start when percent parameter is true
Fixed Sprite loopCount and call to work properly - animate() was reading paused property of Sprite as true and not paying attention to loop count
Adjusted Accessibility html tags in behind to be rgba(0,0,0,.01) in color to remain hidden when in tag scaling mode
Fixed Tile to work with negative scale objects this lets Tiles have rows reversed or be fully reversed as follows:
https://zimjs.com/explore/tileflip.html
PATCHED - added setting scrollX and scrollY to 0 for fit, full, outside modes
This seems to solve the issue on iPad when changing orientation - it was left scrolled! Despite never scrolling - sigh.
Updated TypeScript, Templates, Code Page, CDN, Docs and Updates ;-)
ZIM TEN 10 - adds 29k
ZIM 10 offers a more integrated Physics and a formalized Pick() class for ZIM VEE dynamic parameters.
A new SVGContainer class lets you convert SVG to ZIM Blob, Squiggle, Rectangle and Circle objects - thanks KV for the help!
There is a new site ;-) with TEN sections that highlight types of things that can be made with ZIM.
Specific video entries for each doc element are under way.
PHYSICS - IMPROVEMENT
See: https://zimjs.com/physics/
Integrated Physics into ZIM DisplayObjects and the Docs.
Still need to import Box2D and the ZIM physics module - updated to version 2.
Making a physics object and mapping a ZIM object is no longer needed.
var circle = new Circle().center().addPhysics();
will create a default world and drop a circle in it!
Access the physics object with circle.physics
Or premake the world with new Physics() - to customize gravity, borders, scroll, etc.
The addPhysics() lets you set a bunch of parameters about the body.
Access the physics body with circle.body
DisplayObject Methods:
A set of methods are added to the DisplayObject when physics is in place:
impulse(), force() and torque() methods to push objects around and spin them.
impulse() is a one time push like shooting a pool ball
force() is a force over time like gravity or wind and is applied in a Ticker, etc.
torque() will rotate or spin the object around its center
The control() method will let keyboard keys move the object.
The follow() method will let the stage follow the object when the Physics scroll parameter is set to true
Contact can be tested for with contact() and contactEnd()
each receives a callback function that is provided with the other contacting object and body
Physics Methods:
The physics class has a join() method that can join objects in a variety of physics joints.
The physics class has a drag() method to specify which objects are draggable.
There is a debug() method to see the physics world behind ZIM.
The world can be set up to be bigger than the frame and scroll to follow an object.
PICK
Added a Pick() class to featured code module
This takes the place of zik() when processing ZIM VEE values.
ZIM VEE is so handy that a more generic class was created to share with the world of coding
Pick() accepts parameters for a series, an array for randomly picked, a range object for a range or a function that returns a value
The Pick object has a choose() method that is used internally - but can be used by coders in general.
There is also a chainable num() method that lets you set the number of choices
The Pick object also has a loop() method so you can loop through the options getting the next picked option each time.
If you have an array and want a series you can use JS6 Spread ... or use new Options(series([your array]));
ZIM Pick is a stand-alone class that can be copied and used in other languages for delayed parameters.
SVG CONTAINER
Added SVGContainer class - that turns SVG into ZIM Squiggles or Blob paths
Thank you to KV from our Slack team https://zimjs.com/slack for the help on this!
The tech is still in experimental stage but will translate most SVG - no CSS on SVG...
The paths can then be used to animate along, drag along, make a LabelOnPath, etc.
Also consider svgToBitmap() if you are just wanting to view an SVG file in ZIM
HIERARCHY
Added a zim Hierarchy() class to accommodate nested data.
This is used by the accordion but could be used in making a "Mind Map" or a Tree interface, etc.
The Hierarchy class comes with handy methods to traverse a hierarchy.
This is similar to DOM processing but uses Object literals and as such, can store any Object
LIST ACCORDION
See: https://zimjs.com/ten/accordion.html
Added an accordion parameter to List to handle expanding and collapsing sections to a List.
Uses ZIM Hierarchy for creating and tracking the nesting.
TIP
Added a Tip() class under components just after Toggle.
Tip() is a Label that has show() and hide() added to it
Tip will hide automatically 2000 ms after showing - or whatever you pass in as a time.
Tip also has align, valign and margin, marginH, marginV to easily position based on a target
There is also an outside parameter you can set to position outside a target
Tip is added to the stage - initially it was added to the target but the target might be rotated, etc.
Thanks Ami Hanya for the requestion for Toast ;-)
GENERAL
Added enabled property to List
Added selectedRollBackgroundColor and selectedRollColor to Tabs, List, Pad - sigh BREAK. These default to rollBackgroundColor and rollColor
Added dampKeyup to MotionController and dampKeyup property to control the damping on the Accelerator when keyup is used in MotionController.
See: https://zimjs.com/explore/sidescroller.html
Added expand to Window overlay rather than black with alpha .01
Made loop() work on an HTMLCollection (it already works on a NodeList)
Added q, r, s, t points to ZIM Point - used with SVG - Cubic Beziers and Arc
Added addChar(char) and removeChar() to Keyboard()
Added x and y to rot() to rotate around any point (relative to the container)
Added event object to hotSpot click - also added callOver and callOut parameters
Added "myCanvasAlternative" system to show alternative content if no canvas
or to screen readers and possibly search engine indexing
Added hotSpots property to HotSpots which is an array of HotSpot objects
Fixed sink to work with new Emitter system (particles container independent of emitter position)
Adjusted Tile so it does not clone first item but rather uses item passed in to Tile.
setting slider enable false does not remove cursor to start
setting animate of color:[blue, green, red] does not work
*** patches
Adjusted cloning - to initially only copy matrix if shape or not a ZIM object
but realized that that lost cloning of x, y, scale and skew so backed out of that change.
Added buttonDown property to Tabs and itemDown property to List to get currently pressed item.
Added getItemIndex(item) method to List
Added clamp parameters to Proportion, ProportionDamp and Parallax defaults to true
Set this to false to get values outside min and max range - thanks Ami Hanya for the prompting
Adjusted scrollTop on Frame to default to false - this was for older iPhones - live version 5 - and does nothing otherwise
It was reported that it might mess up mobile when tag mode is scrolled to the bottom - so we have defaulted it to false.
Fixed stopAnimate() so it works with drag:true setting
Fixed Blob controlLength parameter - was not using parameter value - now it is!
Made Squiggle and Blob move parameter only stop overall dragging when set to false - that is what was intended
Passed a CreateJS tick object to any function added to Ticker with add()
this gives delta, time, timeStamp, etc. - thanks Alfred Yim for the prompting!
Ticker.raw() functions receive a DOMHighResTimeStamp
Fixed Tile to properly not clone if clone:false is set - thanks Racheli Golan for the find.
This was introduced initially in 10 for ZIM Shapes accepting ZIM VEE for size and color - we mixed up a conditional and it is now patched.
Adjusted Blob to properly close path so there is no gap on thick borders
Controls were hiding behind transform objects since updates in 9.5
This has been fixed but should be monitored further.
NOTE - as of 2/26/2019
SVGContainer has been updated - thanks KV for all the testing and updates on that.
Here is a mess of an example: https://zimjs.com/explore/svgcontainer2.html
Note - currently it does not do arcs nor does it use styles.
Note - there are a few differences we are still working on so expect another patch.
Diffences have been patched as of 3/1/2019
Also added label property to end of Sprite parameters
This will stop the sprite on the label for texture packer approach
See https://zimjs.com/explore/fruit.html
SVGContainer() and svgToBitmap() now handle remote SVG, SVG tag and SVG string as input
TypeScript, Templates, Distill, Bubbling, Code page, have all been updated.
Blog and Social Media launch, still to come.
ZIM 9.5.1
Fixes for zns=true - various colors and objects were missing the zim namespace within ZIM.
Thank Alfred Yim for the report.
Adjustments to the Keyboard were made to handle no labels provided (thanks Ami Hanya for the find)
Added startPaused and mouseMoveOutside to Parallax as well as a paused property and pause(state) method
Thanks Frank Los for the prompting
ZIM 9.5.0
LAYER
https://zimjs.com/explore/layer.html
Added a Layer component that provides a Container with transform controls
ZIM transform() objects have their mousechildren turned off so they can be dragged and transformed.
This means there can be no interactivity inside the transformed object.
IMPROVEMENT Layer provides a solution to nest transformed objects in transformable containers.
It does so by providing a titleBar that can be used to turn on and off the transform of the container
and allow its contents to be transformed when the transform controls of the Layer are turned off.
This is more than just hiding the transform tools but rather removing and adding them.
Thank you, Stefan Soljemo for the suggestion on Slack https://zimjs.com/slack
The Layer titleBar will always remain visible on the stage
If the Layer is moved (not by its titleBar) so that the titleBar hits the edge,
then the titleBar will become anchored to the edge (unless anchor is set to false)
This creates an independent titleBar that can be moved to any location.
The titleBarPos() method can also be used to separate the titleBar at any time.
Drop the titleBar on the top left corner of the Layer or doubleClick it to snap it back on to the layer
EMITTER - IMPROVEMENT
https://zimjs.com/2018/slack.html
Changed Emitter to emit to a particles container BREAK - this gets added right under the emitter
This makes the emitter be moveable without moving all the particles that have already been emitted.
KEYBOARD - IMPROVEMENT
Made Keyboard work with center and right aligned and scaled Labels as well as backgroundColor and backing and padding.
Turned off resizing the keyboard on show(). You will need to custom scale or position again after a keyboard.resize(); Thanks racheli golan
TRANSFORM - IMPROVEMENT
Added events parameter to transform() and to transformControls for dynamic setting
This will turn on transformed event for pressmove on controls as well as the traditional pressup.
Added a "transformshow" and "transformhide" events to add() and remove() for objects with transform()
Fixed nested transforms, cursors for transforms in rotated containers
Added NOT activating and deactivating transforms when objects are clicked that are on top of transform object - using getObjectUnderPoint.
Added toggleGhost(), showGhost() and hideGhost() methods to transform transformControls object to show outline of object when transforms are not showing.
PARALLAX
Added startPaused and mouseMoveOutside parameters to Parallax
Also a pause(state) method and paused read-only property
GENERAL - NO BREAKS
Added borderColor and borderWidth to RadioButtons and changed backgroundColor to be background color of circle rather than border color
Changed backgroundColor default to be white with .8 alpha
Fixed Sprite to accept CreateJS SpriteSheet - earlier testing for auto image had disabled ZOE import.
Fixed Pane to receive a pattern - the rectangle had flatBottom param...
Adjusted Rectangle with and height defaults to be each other if only one is provided - so providing one will make a square of that value
Added close and closeColor to styles for Pane
Added test in STYLE to not try and clone any stage or stageGL values.
Updated addTo, center, centerReg STYLE to allow single container value - did require config objects (which still can be used). They also accept true
Button, List, Window, fixed cloning with border set to -1 - this was being set to null and then cloned to be default of 1, etc.
Fixed rollColor property of Button - was setting label color not rollColor
Fixed Button clone when border turned off and icon present - which turned default to have a border
Fixed glitch in animate along path (introduced in 9.4.1) so object now stays in place at end of animation (Thanks Alfred Yim and Frank Los)
ZIM 9.4.1
Various IMPROVEMENTS and updates (no BREAKS) while working on GEN-PEN at https://zimjs.com/genpen
GEN-PEN is a full app with lots of List, Organizer and Panel interface and Pen and MotionController work.
LIST
Added an itemsText read-only property to List to give an array of item label text - if no label then null in array.
Added a clear() method to the List
Fixed bug when enabling button having mouseChildren set to true - now will remember this when re-enabling
By default, the Button has mouseChildren set to false but in some custom buttons this is not desired.
This is rare - but the custom List buttons in GEN-PEN to drag, lock, and hide were aversely affected.
Added getter setter method for text property of Label - so if Label is manually changed, text property reflects change
PANEL
Added index parameter to nextPanel() on Panel - if using a series, can go to specific index default null for next chosen panel.
Added event parameter to nextPanel() on Panel default false - set to true to make nextPanel() trigger change event
Added an overlay property to Panel that makes the panel dark when enabled is set to false
Added an extraButton parameter to Panel to give an extra button for reseting for instance.
PEN
Added lineAlpha and lineBlendMode parameters and properties to Pen that work on each line
Added sizeScale and spreadScale properties to Pen to scale these values after picked from optional ZIM VEE values
Changed deleted Pen lines to be visible false rather than alpha false (internal so new lineAlpha is easier)
Added Pen sizeFactor and spreadFactor properties that work independently from sizeScale and spreadScale
This allows two dimensions of pen manipulation - for animating and adjusting depth, for instance
Added note to Pen that cropScale should be kept at 1 for iOS to avoid oversize canvas issues
Added lastSelected property to Pen that remembers the last selected segment
Included pressmove events in enabled property of MotionController
Added infinite property to Pen to draw single segment until stop() is called
Made animating pen along a path start with infinite and end with stop() - also adjusted for pauseAnimate() and stopAnimate()
GENERAL
Added to Squiggle and Blob the following properties:
lastSelected - access to the last selected (or created) control container
lastSelectedIndex - the index number of the last selected controls
Fixed a bug in animate that was not letting a path animate twice in some cases - just set the target pathRatio to null when animate ends
pathRatio is used internally - percentComplete is used externally and works when tween is running but was missing being able to set it ahead of time...
Still may not set pathRatio ahead of time, but pathRatio is being set back to null at end of animation and will be set to 0 at start of next animation.
This may lead to a situation where we want to start at a percentComplete...
oh... that should be okay as the animate will start at 0 and jump to the percent complete on first Tick.
This is better than starting at 0 and jumping to the 1 (pathRatio max) before percentComplete even kicks in...
Should be good... could possibly flash unless we caught that - will keep an eye on it...
Fixed mousewheel scroll to work when hovering on Window (or List) - was using e.stageY on a window.addEventListener (not going to work!)
Adjusted decimals time parameter to also show minutes : seconds rather than minutes : decimal minutes
Added calculate() to MotionController Ticker to calculate speed on manual x and y input
fixed Waiter dispose() to properly remove createjs tweens - thanks Frank Los.
Added cursor to objects with hov() set to true
Added pausing the drag in animate() to the pause() method added to the target by animate() - thanks Jaime Convery for the find
Limited ratio of ZIM colorRange() to between 0 and 1 - wiggle of color sometimes goes a touch under or over resulting a hex number conversion with one extra character (black)
Updated Docs, CDN, Code page, Templates, TypeScript and announced on Slack at https://zimjs.com/slack - no bubbling videos... but an Explore on GEN-PEN
ZIM 9.4.0
ORGANIZER
https://zimjs.com/explore/organizer.html
Added a ZIM Organizer class to organize a List
This lets the user add and remove items, and move them up and down in the list
The Organizer can be found in the docs under components above Loader near bottom of components
The organizer parameter of List can be used to add the organizer to the list.
This will insert the organizer at the top of the list (and under the titleBar if there is one)
Or a list can be passed to the Organizer's list parameter and then it can be manually positioned
In making the GenPen app, the Organizer was used a half dozen times for three different purposes - very handy
PANEL
https://zimjs.com/explore/panel.html
Added new Panel() class just before Pane() in Components.
This gives a box with a title bar and optional arrows for more than one screen in panel
Panel is more simple than a Window - which has scrollbars, etc.
Panel can be dragged but has no close button - perhaps a Pane() would be used for that
Passing in a series to the Label and color/backgroundColor will make multiple screens (shown one at a time)
A choice of a single right arrow or left right arrows can be used to cycle through the panels
PEN AND MOTIONCONTROLLER - IMPROVEMENT
Changed pressupStop parameter to immediateStop - (default true)
if pressup is used (drag or MotionController) then stop drawing immediately when press is up
set to false to keep drawing until damping is finished.
Adjusted mouseDownIncludes on MotionController to include specified object even when inside a container
Fixed bug in Pen with new paper after old paper has been moved
This was an addTo() - remember the default of addTo uses localToLocal to match positions
Using shape.addTo(newPaper, 0, false) solved a very tricky bug... for when you expect a 0,0 position.
Added "recordUndo" event to Pen to help tie pen in to outer undo system
Fixed up nib system - so now no invisible default nib - was causing simultaneous draw and drag issues.
Nib with drag uses different placement than nib with MotionController, etc.
LIST AND TABS - IMPROVEMENT
Added scrollBarOverlay parameter to List BREAK - after scrollBar parameters
This defaults to true and will overlay the scrollBar on the list rather than add space - which would leave a gap when scrollBar is not there
Adjusted List to not override padding with spacing. So it will default to spacing but you can alter padding, paddingVertical and paddingHorizontal
Remove indentHorizontal and indentVertical - BREAK these were needed for label indenting but then we added labelIndentHorizontal and labelIndentVertical
The indent will work only on its direction - horizontal or vertical. Padding works in all directions.
Adjusted the docs of List to describe spacing, indenting and padding relationships.
Fixed selectedColor glitch in Tabs - was not starting with selectedColor for text as this was pasted in the rollColor
Adjusted Tabs to use zim.copy with clone set to true for proper cloning.
Adjusted List and Toggle to use zim namespace in DUO function to work properly with zns=true
Made vertical:false List slideSnap be "horizontal" by default
Added support for starting with an empty list
Adjusted Tabs and List removeFrom() to not give error if no items to remove
Added original color and backgroundColor to custom Button objects passed in to list or tabs
No longer giving "tabs have total less than width" message - instead setting the width to the width after the tabs are made (BREAK)
Fixed Tabs backdropColor defaults - had typo for backgroundColor defaults
Adjusted Tabs rollColor on first item
Added excludeCustomTap parameter to Tabs and List to let custom Button objects have their own tap() - for instance, if previously set
Fixed glitch in height when using titleBar.
Made tap() ignore List titleBar and organizer
List now accepts corner in format of [topLeft, topRight, bottomRight, bottomLeft]
Adjusted Tabs backdrop to change size if the tabs change size
Added clone parameter to end of List and to addAt() method
TILE - IMPROVEMENT
Added ZIM VEE support to align and valign for Tile - now can set a series() for different alignment!
Can already set ZIM VEE for different column and row sizes.
ZIM VEE for align and valign is not supported with matching squeezeH and squeezeV specified - too complicated.
TAG - TEXTAREA
IMPROVEMENT These now support drag() and gesture() (no rotation) - thanks KV for the catch!
The https://zimjs.com/explore/tag.html has been updated with a drag() example at the bottom in red
backgroundColor, padding, paddingHorizontal, paddingVertical, expand parameter have been added
The drag will naturally work around the edges of the HTML tag
The padding (default 10) will trigger drag as will the expand (default 20)
So if you have a large padding, you may want to set expand to 0 for instance.
To make the whole tag drag use: myTag.style.pointerEvents = "none";
VEE
added vee(obj) to code module under featured
vee(obj) is a short function that returns true if obj is in ZIM VEE format else false
ZIM VEE format is [], {min:a, max:b}, function(){}, {noZik:x}
ZIM VEE is a way to pass in dynamic parameters or style properties
This is very handy to pass in a series() function or an array for random pickings, etc.
Used to create dynamic particles with the Emitter or tile specific items in order, etc.
ZIM VEE accepts any value and if not in ZIM VEE format, will just return the object
It is called ZIM VEE as it was launched with ZIM VEE (5) - we are on ZIM NIO (9)
GENERAL
Added a titleBarBackgroundColor to Pane and changed titleBarColor to be for the label of the titleBar - like Window, List, etc.
Fixed a glitch in MotionController - since Accelerator was added - was not dispatching "moving" events properly
Adjusted loc() to not default to 0 if x or y is missing but rather keep the object's current x and y
Fixed CheckBox style for checked style to work properly.
Fixed second arrows on Stepper to work since shifting parameters on Triangle.
Made LabelOnPath accept a string for the label parameter - and then it converts the string to a Label
Added automatic pointer to object with tap()
Patched 9.2.0, 9.2.1, 9.3.0 with loc() in transform() rather than pos().
Fixed swatch text on ColorPicker to align "center" when changed
CDN, code page, templates, Distill, TypeScript, GitHub, Docs updated
ZIM 9.3.0
PEN - IMPROVEMENT
https://zimjs.com/explore/pen_undo.html
Re-organized internal pen to accommodate multiple undo and redo and individual drags and deletes
The paper property is now a Container that holds either Bitmaps (if cache is true) or a shapes (if cache is not true)
Added a draggable parameter (default true) to let pen segments be draggable
Added an onTop parameter to dictate whether the dragged segment comes on top
Holding the CTRL key will drag all the segments - actually drags the paper
Added an deletable parameter (default true) to let user remove segments
SHIFT press on a segment to remove it
CTRL SHIFT press to delete all
paper refers to the Container and is read write to change containers if desired (draw different layers, etc.)
The shape parameter has been changed to paper - to receive an optional Container
If no container is provided Container is made and placed one layer under the pen in the Container that holds the pen
There are no more shape and bitmap properties as there is now a bitmap or shape per each line drawn - so use paper.getChildAt() if necessary
Added a "stop" event to pen that triggers when the motion has stopped (after damping)
Pen now has an undo parameter that defaults to 0 - set to a number to add undo and redo functionality
Added a saveState(obj) method to record a transform change to the paper or a line segment for an undo state (only needed on manual change)
This by default happens when the stop event triggers
Added an undo() method that goes back one recorded state - can be called multiple times - but does nothing if past the undo level set in parameter
Added a redo() method to redo any undo() calls - unless draws.
Added an undoLevels property to get or set the number of undo levels
Added a draggable property to read only if segments are draggable
Added a cropScale parameter that defaults to 1 (stage size) - increase if you want to drag or move shape and paper
Made pen use localToLocal with shape so can move paper and still sync up drawing.
Added a delete(index) method to delete a line segment at a given index (actually sets its alpha to 0 to maintain layers on undo)
Added a deleteSegment(segmentObject) method to delete a line segment object (actually sets its alpha to 0 to maintain layers on undo)
TAG
https://zimjs.com/explore/tag.html
Added a Tag() class to create and overlay a div tag with a certain dimension
Any HTML can be added with the add()
Also has tag, innerHTML and style properties
There is a resize() method to be called if manually moved or scaled.
Resizing a fit or outside mode will auto resize.
Pane and Pages will handle adding and removing.
The overlay effect is the same as with TextArea and Loader
So canvas objects will always appear beneath the Tag
and there is a minor lag when resizing windows or dragging a pane, etc.
ORD
Added an ord(num) chainable method to move (relative) layer index
So circle.bot().ord(1) moves up one from bottom and circle.top().ord(-2) moves two down from top
INHERIT
Added inherit parameter to all classes with style.
This can pass styles on to objects made by the class - used internally
But could be used to pass styles directly into a class as it is created
Made List pass on styles to Window and Tabs through this system IMPROVEMENT
Now setting size:10 on list will change the size of the Label in the Buttons of the Tabs of the List (unless custom objects in list)
LIST - IMPROVEMENT
Fixed List to work properly with padding (and paddingVertical, paddingHorizontal) - these now default to the spacing in their direction.
They can be set to 0 to have no space on the ends of the list
Added horizontal slideSnap to Window - was left off
Changed List to default to currentSelected:true
Added first() and last() chainable methods to Tabs and List
Added selected, text and label properties to List
Fixed a slight positioning error in addAt() - no need to re-adjust the tab size as it is done in tabs
Fixed Tab select and unselect colors now that items can be added to and removed from tabs - internally, the tabs should only be used at start
Fixed up scroll max to take into account padding
GENERAL
Adjusted getQueryString() to remove + from urlEncoded data IMPROVEMENT
Adjusted Bitmap to clone actual width and height not ignored 100x100 default as that messed up clones.
Adjusted Stepper so setting min and max property limits number and adjusts greyed arrow if need-be.
Patched 9.2.1 with stepper setting as well.
Made MotionController ignore CreateJS objects which do not have a hitTestPoint, etc.
Added a hasProp(string) method to all display objects
ZIM 9.2.1
Adjusted STYLE, POSREG, DRAGALL and KEYFOCUS to work with zns=true - thanks Ami for the find.
Changed about 20 references to colors, and zim functions like copy, merge, etc. where namespaces were not used - this can mess up when zns is true.
This update needed to be made but could not safely be a patch due to the number of changes.
Adjusted frame.asset("somesound.mp3").play({loop:-1}) to also be {loop:true} and added a loopCount property for optional number of loops.
but can also still use loop:-1 or loop:10.
This is consistent with how loop works in animate(). The loop:-1 still works as well.
Added a password Boolean parameter to TextArea to make the field a password field (one line input field) - thanks Andi for the suggestion
If animate() is missing props it gives a console message (with zon=true) and returns the object.
TypeScript is updated.
ZIM 9.2.0
PEN
https://zimjs.com/pen.html
Handles dynamic drawing with a set of different penTypes
You can drag() or gesture() pen, move it with a MotionController(),
animate() it, animate() it along a Squiggle or Blob path, etc.
Holding down the CTRL key will allow the pen to move without drawing
LABELONPATH
https://zimjs.com/explore/labelonpath.html - thanks KV for the request!
Makes a label along a path of a Squiggle or Blob - which can be interactive, fixed, toggled or hidden
A list of percentages for where the letters are can be provided to move around letters
TOGGLE
https://zimjs.com/explore/toggle.html - thanks Andi Erni for the idea and code start.
Added a Toggle() component after the RadioButtons
Parameters: width, height, label, startToggled, backgroundColor, margin, indicatorType, indicatorColor, toggleBackgroundColor,
color, borderColor, borderWidth, corner, indicatorCorner, shadowColor, shadowBlur, time, labelLeft, style, group
Gives a change event and check the toggled (or selected) property - works with STYLE and Accesibility
LIST
https://zimjs.com/explore/list.html
https://zimjs.com/explore/listObjects.html
Added a ZIM List component for a vertical or horizontal list of items - thanks Andi Erni for the prompting
This is really a zim.Tabs object inside a zim.Window object.
The list can be strings, numbers or Label objects and these are added to Tabs buttons.
The list can also include any DisplayObject with bounds (which most ZIM objects have except a Shape needs bounds set manually with setBounds()).
If the object is not a string, number or Label then selection will not highlight and currently animateTo() may not work if size is different.
Items can be added or removed from the list with addAt() and removeAt()
You can animateTo() and index as well - not working properly yet for when custom objects are in the list
BUTTON AND TABS - IMPROVEMENT
https://zimjs.com/explore/verticalTabs.html
Added align, valign, indent, indentHorizontal, indentVertical parameters to end of Button and Tabs
BREAK - added a vertical parameter to Tabs just before spacing set to true to make vertical tabs
BREAK - removed flatBottom parameter of Button and for Tabs it is changed to base with default "none" when no corner or corner is an array
and more values of "bottom" (default when corner and not vertical), "left" (default when corner and vertical), "top", "right"
corner will then be the opposite corners to the base
Added borderColor and borderWidth styles for Tabs
Fixed currentSelected to not show selected value - got lost in color / backgroundColor change over
BREAK - removed flatBottom from Rectangle as corner is now configurable with Array and Tabs use base rather than flatBottom
Note - this breaks any traditional parameter order pointing to dashed.
BREAK - Added labelAlign, labelValign, labelIndent, labelIndentHorizontal, labelIndentVertical parameters to Tabs
**** Added change() and noChange() chainable method to capture change events on components
FLATBOTTOM - REMOVED - BREAK
The flatBottom parameter has been removed as corner now accepts an array and Tabs use base for more flexible horizontal vertical arrangement
So the parameter order of Rectangle, Button and Loader from dashed on has been changed
IMPROVEMENT MOUSE POSITION ON TOUCHSCREEN
USE Mouse Event Object: e.stageX AND e.stageY - NOT stage.mouseX and stage.mouseY - these last two do not work with touch screen.
We have 100 places where we get mouse positon and almost all are working fine.
But we missed one for the initial point down for dragging with slide - this has been fixed
Went through docs and fixed all examples using stage.mouseX, etc.
Fixed minor places in Stepper and Parallax as well.
GENERAL FIXES
Added default particles to Emitter.
IMPROVEMENT - Squiggle and Blob when animating rotation of points now adjusts animation along path correctly - for animated paths (interactive was fine)
BREAK - Indicator parameters have changed to foregroundColor, backgroundColor (for not selected) and backdropColor for the backdrop (which is often left out)
The background property has been changed to backdrop. Pane and Tabs also have a backdrop - it is the background behind the background ;-)
So the layers are selectedColor (font), color (font), foregroundColor, selectedBackgroundColor, backgroundColor, backdropColor - sigh.
Added onTop and interactive properties to Squiggle and Blob
Added a getAngle parameter to Squiggle and Blob getCurvePoint() and the CODE module pointAlongCurve() function
These now return an angle at point property along with x, y, etc.
Fixed a bug in pos() when bounds set to negative x and y
Made align:"middle" work as well as align:"center" on label
Adjusted ColorPicker to accept borderWidth and borderColor styles - for color rectangles or circles
Fixed glitch in Swiper to work properly with stage as the swipeOn parameter.
Fixed glitch in MotionController introduced in 9.1.0 with accelerator (put brackets around ternary when used in calculation)
BREAK - changed mouseDownIncludes parameter and property of MotionController to mousedownIncludes.
Added target automatically to mousedownIncludes in MotionController - this can be removed from the property array if not desired
Fixed flip vertical problem with MotionController - now points the right way! We suspect hackers.
Added a clear() method to ZIM Dictionary()
BREAK - adjusted Label to not automatically center on a backing (by default there is no backing)
backing is added when you add a custom backing DisplayObject
The Label now will align and valign properly on a backing with padding - as opposed to automatically centering.
BREAK - changed CheckBox check property to indicator and color to indicatorColor
BREAK - changed RadioButton dots property to indicators
Adjusted margin on CheckBox to be closer to CheckBox when set to 0 (inline with RadioButtons and new Toggle)
Adjusted the right hand and bottom margin of RadioButtons a little.
BREAK for objects with outline(), changed toggle() and toggled to outlineToggle() and outlineToggled so as to not conflict with other toggle() and toggled methods and properties
Fixed talk() for Accessibility - talkTag.setAttribute("aria-hidden", !_aria); seemed to be making it not work anymore?
Added Toggle component to Accessibility
Added wait time to sequenceWait call - was taken out during wait updates
Fixed a bug in running a Sprite backwards and not ending at 0 - thanks Alex Gopher for the find.
ZIM 9.1.2
SQUIGGLE AND BLOB UPDATES
Added an interactive parameter to Squiggle and Blob to quickly turn off controls, drags, selects, etc.
This leaves just the shape and should be set to false when not needing to interact with shape
Added pointControls and pointCircles properties to Squiggle and Blob to access these arrays directly
Before we had to go through pointObjects[0][0] to get to control container and pointObjects[0][1] to get to circles
Animation should be done on the pointControls but immediate placement should be done on the pointCircles
This is because when dragged, the circle is moved but the control is left in place until mouseup
Added a transformPoints() function in the Code module to scale, rotate or position points in a Squiggle or Blob format
Added a transformPoints() method to Squiggle and Blob that use the transformPoints function to change their points
This allows you to scale or rotate Squiggle or Blob points without affecting their control points or stroke thickness
https://zimjs.com/explore/scalepoints.html
EXAMPLE
// Transform the original points of a Blob
// If you rotate or scale, this affects the control points - the little rectangles rotate or they scale
// To avoid this, the points themselves can be transformed (scaleX, scaleY, scale, rotation, x, y)
// This makes a square and scales it bigger without affecting control size or stroke size (if there were a stroke)
// Note the default number of points is 4 but they are arranged at the top, bottom and sides - so would make a diamond with just controlType:"none"
new Blob({controlType:"none"}).transformPoints("rotation", 45).transformPoints("scale", 2).center();
END EXAMPLE
Fixed a glitch when unpausing a dragged object along a path
Made objects follow a Squiggle or Blob path as the path is being moved or manipulated IMPROVEMENT (although also patched in ZIM 9.1.0)
This results in a better experience when editing live animations
EMITTER
Adjusted Emitter to work if not added to stage or parent.
Changed Emitter pause() and paused to pauseEmitter() and emitterPaused - to not conflict with animate() pause() and paused
as sometimes we animate the Emitter. BREAK
SERIES
Made series() hold just regular parameters or a single parameter of an array.
series(red, green, blue) is now the same as series([red, green, blue])
LABEL IMPROVEMENT
Added a "baseline" value for valign parameter of Label that puts the registration of text at the baseline
Added labelWidth and labelHeight parameters to Label - use them both to override font size and fit text to dimensions provided.
https://zimjs.com/explore/text.html Thanks Ami Hanya for the prompting!
labelHeight on its own does nothing. labelWidth on its own is the same as lineWidth - it will wrap a the provided value.
ZIM 9.1.0
MULTIPLE SELECT SQUIGGLE AND BLOB POINTS WITH DRAG AND ARROW CONTROL
Try it out at https://zimjs.com/explore/multipleSelect.html
Added select and multiple select (with CTRL key) to Squiggle and Blob. IMPROVEMENT
Selected control point circle and handles can be dragged or moved with arrow keys.
Shift arrow key moves 10 pixels at a time.
Changed the CTRL click to SHIFT click for removing an existing point BREAK
Added a single undo (for now) for adding or removing control points
Added Squiggle and Blob to the KEYFOCUS
Added selectColor (string) and selectPoints (boolean) parameters before editPoint BREAK
Added SelectionSet and SelectionManager to the Controls Module
See https://zimjs.com/explore/selectionTest.html
Adjusted zog() and zta() to not show if zon (comments on) is set to false before ZIM is loaded. Thanks Ami for the prompting.
Fixed Sprite() run() so that call:function(target){} receives the target properly if no params are passed. Thanks Chris for the find!
Adjusted the MotionController to accept the container in the mouseDownIncludes - previously only children of the container were eligible. Thanks Alicia for the find!
Replaced all frame.color with just color as these are now stored on ZIM - this helps DISTILL run without Frame.
frame.color will still work.
Tidied up dblclick cycle colors in Squiggle - when adding new point was using Blob defaults. IMPROVEMENT
ZIM NIO (9) ~ added 11k
Mini-site: https://zimjs.com/nio/ that demonstrates new features - here is a summary:
animate() - convenience props: path, orient, flip, flipVertical, zoom, speed, layer, fade, extra
animate() - parameters: dynamic, drag, clamp, startPaused
animate() - properties added to target: percentSpeed, percentComplete
animate() - methods added to target: paused() - to support Accelerator()
Accelerator() - now accepts targets with dynamic animation
MotionController() - now accepts an Accelerator as a target
** more details below
PIZZAZZ 4 - Blob and Squiggle shapes and animation path shapes
https://zimjs.com/nio/paths.html
DOCS - CUSTOMIZE
Added a TOP link to the search area
Added a Customize link to a tool to make a list of items used in your ZIM code
https://zimjs.com/customize.html
These will make various sets of links that will feature these items
https://zimjs.com/docs.html?item=Circle - opens Circle docs.
https://zimjs.com/docs.html?items=Button,Dial,Emitter - shows Feautured Items.
DYNAMIC AND PATH ANIMATIONS - IMPROVEMENT - Thanks Andi Erni and others for the promptings!
The speed of animations can be controlled with the percentSpeed property on the target
Animations can be combined in an Accelerator to control all at once
(along with Dynamos (dynamic Sprites) and Scrollers)
Accelerators can be controlled with a MotionController (or techniques below)
percentSpeed also works with Slider, Dial, Stepper, Swiper and Parallax
percentSpeed also can be added to wiggle or animate
Animations can also be scrubbed with the percentComplete property on the target
percentComplete works with Slider, Dial, Stepper, Swiper and Parallax
percentComplete also can be added to wiggle or animate
Animation along a path (Blob or Squiggle) supports dynamic animation
Objects can now be dragged along a path - see DRAG below
PERCENTSPEED
Added dynamic parameter to animate().
Set dynamic to true to be able to change the speed of the animation
with the percentSpeed property of the target object.
See https://zimjs.com/nio/speed.html
Adjusted Accelerator so it accepts any object with a percentSpeed
including an object that is being dynamically animated.
Added a clamp parameter to animate() to limit dynamic animations to edges of their times
otherwise time can go well beyond and take just as long to reverse to active animation time range
See https://zimjs.com/nio/controls.html
Adjusted MotionController so if an Accelerator is passed in
the MotionController operates percentSpeed rather than x and y
in any of its types - mousemove, keydown, gamestick, etc.
PERCENTCOMPLETE
Added percentComplete property to any object being animated.
Setting this gives manual control for instance with a Slider, Dial, mouse position, Parallax, etc.
http://zimjs.com/nio/parallax.html
FLIP
In addition to orient, there is now flip and flipVertical convenience props for animate()
set these to true to flip the target with scaleX and scaleY depending on direction
http://zimjs.com/nio/flip.html
DRAG
Added a drag parameter to animate() that lets you drag path animations
Set startPaused to true to pause the animation and drag or drag a moving animation.
Added a redirect convenience property to the props object.
This defaults to true so that drag will alter the direction of the animation IF rewind is set
Set this to false to not alter the direction - you can still drag backwards
but when you let go, it will go in the direction the animation was going
http://zimjs.com/nio/drag.html
ZIM NIO EXTRA! - IMPROVEMENT
EXTRA! provides animation based on animation.
This allows for setting zoom, depth, speed, fade, etc. based on target y value while animating on a path
but EXTRA! also opens up endless possibilities as the input and output does not have to be the target.
This means that animation can also control properties of other objects
and other object properties can control the animation.
http://zimjs.com/nio/extra.html
There is a general and full format for EXTRA! but convenience properties are also provided.
These primarily help with depth while animating along a path (Squiggle or Blob) or just a straight line with x and y.
ZOOM, SPEED, LAYER, FADE
Added zoom, speed, layer and fade convenience properties to animate props
These accept an array of values - [inputMin, inputMax, outputMin(default 0), outputMax(defaunt stageH)]
zoom:[.5,1.5] will scale the target to .5 if its location is at 0 and 1.5 if at stageH and then proportionally in between
speed:[50,100] will make the animation play at a slower speed the higher the target is on the stage
layer:[0,10] will make the target change layers from the bottom to the top if animated along the y from y=0 to y=stageH
fade:[0.5,1] will make the alpha fade as the target recedes to the back (top of the stage)
This will help with depth animation to make things farther away animate more slowly
and give the ability to animate around an object depth-wise.
EXTRA
In addition to the convenience properties above, ZIM EXTRA! has a more general and complete format:
Pass in a single EXTRA! object or an array of EXTRA! objects: extra:{} or extra:[{},{},{}]
The object has the following properties - all are optional except the outputProp which is required:
|ZIM VEE| - each object below optionally accepts a ZIM VEE value for zik() to pick randomly from
inputObj - (default target) - the object with the input property - probably the animation target but could be any object
inputProperty - (default "y") - a string of the property name for the input - "x", "rotation", etc.
inputMin - (default 0) - the minimum input value for the calculation - also see constrain
inputMax - (default stageH) - the maximum input value for the calculation - also see constrain
outputObj - (default target) - the object whose output property is being changed - probably the animation target but could be any object
outputProp - (default "scale") - a string of the property name of the output - "scale", "layer", "rotation", etc.
outputMin - (default 0) - the minimum output value for the calculation - also see constrain
outputMax - (default 1) - the maximum output value for the calculation - also see constrain
factor - (default 1) setting factor to -1 will reverse the direction of the animation
outputRound - (default false) set to true to receive rounded output values
constrain - (default true) constrain the output value to outputMin and outputMax
set to false to let values go beyond provided mins and maxes
this is quite usual when a proportion is easily figured at a certain range
and continued increase or decrease is desired outside the range - just turn constrain to false.
EXAMPLES:
extra:{outputProp:"scaleX"} would animate the scaleX of the target from 0-1 over the stage height
extra:{outputObj:circle, outputProp:"alpha"} would animate the alpha of circle based on the animated target's y position
extra:{inputObj:circle, inputProp:"x", inputMax:stageW, outputProp:"level"} would animate the target's child index as the circle's x goes across the screen
** in the last two examples, circle is a different object than the target of the animation - circle might be animating independently or based on a Slider value, etc.
CORNER
Modified all corner properties to accept an Array [topLeft, topRight, bottomRight, bottomLeft]
new Button({corner:[20,20,20,0]}).center();
https://zimjs.com/nio/corners.html
TAP
An chainable tap(call, distance, time, once) method has been added to all DisplayObjects along with a noTap() method
This acts like a traditional click where you down up without moving the mouse (within the distance parameter)
This is handy too as the methods are chainable. The callback function will receive the traditional event object
HOV
Added a short chainable method hov(value, prop) to change the value of a hovered object
By default this is the alpha if a number is passed or the color if a string is passed
new Circle().center().cur().alp(.5).hov(.8).tap((e)=>{e.target.color = red; stage.update();});
GENERAL
Added interpolate and percentage parameters to closestPointAlongCurve()
That returns either a closest interpolated point
or the percent along a path such a point would be - used by drag parameter in animate.
Added damp parameter to Slider and Dial
use with Ticker rather than "change" event - eg:
Ticker.add(function () {circle.x = slider.currentValue;});
Fixed Stepper clone - was missing new color (for text color) parameter
Updated segmentPercents to segmentRatios
to keep all percents 0-100 and all ratios 0-1
Fixed pos() to position properly inside rotated and scaled bounds
had been using boundsToGlobal() should have been using getTransformedBounds()
Fixed thickness now being cloned properly in Squiggle
Removed labelColor and labelOffColor from Tabs as these were replaced by color and offColor - BREAKS parameter order after corner
Adjusted Tabs and Pad color and rollColor of "selected" tab to be colorOff rather than color when currentSlected is false
Adjusted Tabs and Pad so if currentSelected is false, the current selected button does not loose its rollover when pressed
All control objects now have a type property that gives the class name as a string - DisplayObjects already have this
Added pane and textArea properties to Blob and Squiggle to refer to the recordPoints Pane and its TextArea - helps to add interface to popup if desired
like to let user modify point details and submit back to app.
BREAK - changed Window titleBarColor to titleBarBackgroundColor and added a titleBarColor for the text color
Fixed glitch in title bar when not draggable - letting you click through to content - no longer does this
Added size property to Label to change font size after creation - thanks Ami Hanya for the prompting
Welcome to ZIM NIO - fresh on the heels of ZIM OCT - which brought STYLE and cool Tile updates and more!
TypeScript has been updated, code page, Examples page, front page logo, Distill, Bubbling videos, Templates are updated.
Blog to come, social media to come, etc.
ZIM 8.3.0
Added loc() chainable method
pos() no longer positions the registration point unless the reg parameter is set to true
So loc() will position the registration point at loc(x, y)
and default to add to stage, or choose some other container or add at index, etc.
BUT alternatively, loc can also accept any object with an x and y property as its first parameter
This could be another Display Object or a zim Point(100, 100) or an object literal {x:100, y:100}, etc.
When the first parameter is a Display Object, obj.loc() will put its obj at the same place (registration wise) as the Display Object.
This will default to set localToLocal true for exact match - there is a localToLocal parameter if this is not desired.
So... loc() acts just like the old pos() with the option to obj.loc(displyObject) to easily match positions
Currently there is no loc style - it is easier to use x and y styles
as in x:10, y:10 rather than loc:{x:10, y:10}
PATH IMPROVEMENT
https://zimjs.com/explore/squiggleAnimate.html
Added animation along the path with ZIM animate - the following props are added:
path - pass in a Blob or Squiggle to animate along path
this is dynamic so if the Blob or Squiggle changes, the animation will change
if Blob or Squiggle has lockControls = false, then it is not dynamic
if a set path is desired, then lockControls to save processing
https://zimjs.com/explore/blobAnimate.html
orient - an object to rotate the target towards
if path is being used, orient defaults to orient along the path
can set to false for no rotation
can set to any object with an x, y point such as a circle on the stage - or {x:0, y:0} or a new zim Point, etc.
the target will then rotate to face the specified location
https://zimjs.com/explore/blobAnimate2.html
BLOB and SQUIGGLE
IMPROVEMENT Added click blob to add control point and ctrl click point to remove a control point
https://zimjs.com/explore/blobAdd.html
Added an editPoints parameter that defaults to true for the above - or set to false to not add and remove control points
gave Blob and Squiggle controls a num property that matches their points array position
Fixed a glitch when setting points property that was introduced in 7.4.0 where we started using the Container's dispose
IMPROVEMENT Added proper color to handle rectangles when using Blob changeControl
Added segmentPoints and segmentPercents properties to Blob and Squiggle
Added getPointAngle(), getSegmentPoint(), getCurvePoint() methods to Blob and Squiggle
Added pointAlongCurve, distanceAlongCurve, closestPointAlongCurve functions to Code module
IMPROVEMENT Blob and Squiggle now persists even with a changed number of points
Added update event to blob and squiggle for when number of points change
All events on Blob will now be kept but any custom events on the shape or controls will need to be recreated
as the shape and controls are now different objects. So capture the update event and remake your events.
Any events on the shape or the controls will be removed before the objects are replaced with new ones.
Fixed width and height parameters of Bitmap - they were not working since style update in zim 8. Fixed now.
Adjusted centerReg() to add to different container than the current container when a different container provided
Adjusted Keyboard cursor to properly center if Label has background
ZIM 8.2.0
ZIM KIDS
A new section of ZIM has been added called KIDS https://zimjs.com/kids.html
It treats coding as magic and presents the docs as spells ;-)
There is a basic code writeup https://zimjs.com/magic.html
There are currently four workshops with three levels each
The workshops let you see the commented code and type live in the browser
Please spread the word! Obviously, ZIM is not just for kids - but it is a great way to start!
COLOR RANGES AND ANIMATED COLORS - IMPROVEMENT
Added a colorRange(color1, color2, ratio) function to Code module
Added setColoRange(color1, color2) method to ZIM Label and shapes (Circle, Rectangle, Triangle, Squiggle, Blob)
Passing one parameter will set range from current color to the color specified in the parameter
Added colorRange property to ZIM shapes with values from 0-1.
This value will set the color of the object
to the color in the range matching the ratio - this can be used to wiggle the color
Added a color convenience property to animate() that runs the colorRange system
This allows you to animate from one color to another - including rewind, loop, from, wait, etc.
new Circle(100, red).animate({color:blue}, 1000);
Note - does not work with an animation series - use animate() in a call for a series of color changes
Thanks Jade for the prompting! See example http://zimjs.com/explore/animatecolors.html
ZIM now overrides Bitmap.clone() to provide a chainable clone like for Container, etc.
This also will clone the bitmap width and height by default
Usually, Bitmaps do not need to be cloned but to apply a filter they do:
http://zimjs.com/explore/mask.html
And to grab the color at a point they do:
http://zimjs.com/explore/pixels.html
Made MotionController mousedown and pressmove types not trigger if mouse down on an object
Objects with mouseEnabled of false do not count.
Added "toRGB" as a toColorType value.
Added empty containers with 0 bounds to any null Tile() elements (actually patched 8.1.0)
Fixed a few "use strict" issues in ZIM - thanks Bjorn Brockschmidt for the finds
placeReg(obj) - now returns obj for chaining (as does place())
Fixed resetBounds() to return object - was returning this, when meant return obj.
Also, since the last setBounds() update, resetBounds was not resetting if no parameters were passed.
Added a stickColor parameter and property to Squiggle and Blob
ZIM 8.1.0BREAK Changed the currentTarget parameter of drag() to all (default false)
container.drag() - will drag individual items in the container
container.drag({all:true}) - will drag the whole container
currentTarget has been added back to the end of the parameters
for backwards compatibility when using the ZIM DUO configuration objects.
Added a DRAGALL constant that defaults to false - set this to true to make drag() drag the whole container by default
Adjusted Window so titleBar is included in height - possible minor BREAK - thanks Ami Hanya for the find
Removed zim clone method from Stage and StageGL - also fixed copy() trying to clone stage
Added moon color = #ddd
BREAK Adjusted center() and centerReg() to not add to container if already in container (was bringing up to top - now will not)
POS - IMPROVEMENT / BREAK
Inserted right and bottom parameters before the container parameter
The container now automatically defaults to the default frame's stage (or existing parent)
** previously positioned only registration point
** now positions based on sides, top or bottom unless reg is set to true
By default, will position left and top of object - can also position right or bottom
Setting reg (or regX, regY) to true will position to the registration point
x - (default 0 or the current x) the x distance in the container to the left or right side of the object
which side, depends on the right parameter
if reg or regX is true then it is the distance to the registration point not the side
y - (default 0 or the current y) the y distance in the container to the top or bottom of the object
which one, depends on the bottom parameter
if reg or regY is true then it is the distance to the registration point not the top or bottom
right - (default false) set to true to postion the right side from the right of the container bounds
if reg or regX is true then it is the distance to the registration point not the side
bottom - (default false) set to true to postion the bottom of the object from the bottom of the container bounds
if reg or regY is true then it is the distance to the registration point not the bottom
container - (default current container or zimDefaultFrame stage) the Container to add the obj to and position
index, add are the same as before
reg - (default false) set to true to position to the registration point rather than sides, top or bottom
regX - (default reg) set to true to position x to the registration point rather than the sides
will override reg if provided
regY - (default reg) set to true to position y to the registration point rather than the top or bottom
will override reg if provided
Also added pos to STYLE:
STYLE = {
type:{
Rectangle:{
add:true,
// all rectangles will default to a right position of 100, 300 or 500 randomly
pos:{right:true, x:[100,300,500]}
// also corner convenience values: "left", "right", "top", "bottom", "rightbottom" or "bottomright", "center" and "centerReg"
// pos: "right", // send to right
}
}
}
Added a POSREG constant that defaults to false.
Set this to true to change pos() to default to positioning the registration
This will be handy in transition - and who know, maybe you like the old way better.
TILE - IMPROVEMENT - Layouts
See https://zimjs.com/tile.html
Added features to Tile to make it very versatile (haha) in laying out non-scaled content
So, moved Tile to above Layout in the Pages, Layout, Accessibility area
Added width, height, compressionH, compressionV parameters after spacingV in Tile() - BREAK
These handle spreading the tiles out over a width or height and various compressions
This is similar to Layout but does not scale the content so much simpler calculation ;-)
Added resize(w,h) and remake(items) methods
Added a bunch of properties (matching parameters) to make the Tile more dynamic
These can be changed and then resize() called.
Added items property (Array) that can be updated with new items or different items (less, more, etc.).
cols, rows, and items can be changed and then remake() run.
Thanks Ami Hanya for the prompting - this will be very handy
MOTION CONTROLLER - IMPROVEMENT
Added pressmove type to MotionController - good for dynamic drawing with easing - default damp is .2
Added a mousedown event for mousedown and pressmove types
Added moving, startmoving and stopmoving events
Added a mouseMoveOutside parameter that defaults to false
Set to true to let mouse motion outside the stage affect motion
BREAK Changed rect parameter to boundary
and added a boundary property for dynamic boundary adjustment - thanks Andi Erni for the suggestion
BREAK - moved the container parameter to near the end and made it default to the zimDefaultStage
Updated CDN, GitHub, Templates, Distill, Code page, Docs, TypeScript,
Todo: Slack, Facebook, Twitter, Blog
ZIM OCT (8) ~ added 16k
STYLE
Replaced DEFAULTFONT with a general STYLE system. IMPROVEMENT
STYLE can be used to set any parameter on a DisplayObject.
For instance: Circle, Blob, Button, Pane, Bitmap, Sprite, etc.
These are applied at the time the objects are made.
They are cascading with each level overriding the previous level:
1. GENERAL: any style can be specified in general
corner:30 will make all corners default to 30
2. TYPE: styles for object type can be set to override the general styles
Button:{corner:0} will make all button corners default to 0
3. GROUP: styles for a group can be set to override the type styles
homePage:{corner:20} will make all objects of that group default to 20
4. OBJECT: styles applied as parameters to the object override all other styles
new Button({corner:40}) will make this button have a corner of 40
STYLE = {
corner:20,
backgroundColor:pink,
type:{
Button:{width:{min:100, max:500}, corner:0, centerReg:true, move:{y:series([-150, -50, 50, 150])}},
Dial:{add:true, x:800, y:600, backgroundColor:red, scale:2, outline:true},
Pane:{corner:ignore, color:white, draggable:true, width:300, label:"HI!"},
ProgressBar:{add:true, x:200, y:600, barType:"rectangle", transform:true},
Tabs:{add:true, x:100, y:100}
},
group:{
homePage:{corner:30}
}
}
new Button(); // will have a corner of 0 and be pink
new Button({group:"homePage"}); // will have a corner of 30 and be pink
new Button({corner:10, group:"homePage"}); // will have a corner of 10 and be pink
new Button({corner:"ignore"}) // will have a corner of its default 20 and be pink
new Button({style:false}).pos(700,100,stage); // will have original default styles
new Dial(); // will be red and scaled twice as big and have an outline
new Tabs(); // will have a corner of 20 and selection will be pink
var p = new ProgressBar({corner:15}); // will be a bar with transform tools, corner 15
p.percent = 25;
new Pane().show(); // will ignore corner 30 and use its original 20 - it will say HI! in white and be draggable
STYLE = {
borderColor:dark,
borderWidth:5,
type:{
Rectangle:{
// color:red,
color:[red, pink, purple], // pick a random color from here
centerReg:true,
animate:{props:{rotation:360}, time:500, ease:"linear", loop:true},
move:{x:series([-200, 0, 200])}
}
}
}
// make three spinning rectangles
loop(3, function(){new Rectangle();});
See: https://zimjs.com/style.html for an example
TRANSFORM STYLES
Transformations can also be applied (all are numbers - visible is a Boolean):
x, y, rotation, alpha, scale, scaleX, scaleY, regX, regY, skewX, skewY, visible
a bounds style has a value of {x:Number, y:Number, width:Number, height:Number}
where x and y are optional
RANDOM, RANGES, SERIES, FUNCTIONS
Any property value can be a ZIM VEE value to make use of ZIM zik (pick)
color:[red, green, blue] will pick a random color for each object for which the style is applied
x:series([100,200,300]) will place subsequent objects at these locations
width:{min:100, max:500} will make objects with a width within this range
See Docs on ZIM zik() and ZIM series() for more information
FUNCTION STYLES
The following functions have been added:
addTo, center, centerReg, transform, drag, gesture, outline, mov, animate, wiggle
Values of true will give default functionality for all but mov, animate and wiggle
ZIM DUO configuration objects can be set as a value for any of these
example: drag:true; or drag:{onTop:false}
For animate and wiggle, [] can be put around multiple configuration objects
to wiggle in the x and y for instance or run multiple animate calls on the object
CONVENIENCE STYLES
add:true - has been provided to add to the stage (use addTo for other containers)
move:{x:value, y:value} or move:x - mirrors the mov Function style (just adding the e)
style:false - will turn off all styles for the selector
EXCLUSION
A value of ignore can be used to exclude any earlier styles and return to the original default.
ignore is a ZIM global variable - if zns is true then use zim.ignore or just "ignore".
Setting style:false will exclude the object from all styles
All DisplayObjects have a style parameter (default true). Set to false to ignore styles.
GROUPS
All DisplayObjects have a group parameter.
This parameter accepts a string or a comma delimited string of multiple groups.
The group of components can then be targeted in the Group section of STYLE.
A group can contain just one component and act like an ID in CSS.
COLORS
Colors have been reworked for the components (they stay the same for shapes)
Basically, color is now used for text and backgroundColor for the backgrounds - like CSS.
color - text (and rollColor)
backgroundColor - background of component (and rollBackgroundColor)
foregroundColor - foreground of component
borderColor - border on background and foreground
indicatorColor - indicator of component
SUMMARY OF PARAMETER CHANGES - BREAK
Most non-Label color and rollColor parameters and properties
have been changed to backgroundColor and rollBackgroundColor
color and rollColor have been kept when the component has text
and these now refer to the text - specifying a Label will override these.
Added backgroundColor to CheckBox and RadioButtons for the box and circle
The Tabs and Pad offColor is now the text color
and they get an offBackgroundColor to specify non-selected buttons
and they get backing and rollBacking parameters before the waitBacking
Exceptions:
Most components have their color parameter changed to backgroundColor.
The exceptions are those which shift to a foregroundColor parameter:
Waiter, ProgressBar, Indicator has its color parameter changed to foregroundColor.
The color parameter remains on the ProgressBar for its text color.
Waiter has its foregroundColor moved to before its backgroundColor - for consistency
Keyboard:
Changed Keyboard parameters so text gets color and backgrounds get backgroundColor
There are a bunch of these so here they are - old on the left and new on the right:
color to backgroundColor
textColor to color
shiftColor to shiftBackgroundColor
shiftHoldColor to shiftHoldBackgroundColor
placeColor to placeBackgroundColor
placeTextColor to placeColor
shiftBackgroundColor to shiftColor
// TOGGLE
There are objects that have control interfaces that can be shown or hidden:
Grid, Guide, Layout, Blob, Squiggle and objects with outline() or transform()
We have added a toggle(state) method to these
This has also been added to the Manager class which gives it to the GridManager, GuideManager, LayoutManager and TransformManager
Using toggle() will show the control (if hidden) or hide the control (if showing)
You can also use toggle(true) to specifically show and toggle(false) to specifically hide
A read-only toggled property has been added that is true if visible and false if not
BREAK - the transform(), Blob() and Squiggle() toggle parameter and property have been changed to allowToggle
Added the toggle system to Keyboard and ColorPicker, ProgressBar and Waiter (Pane already had one)
Many of these have hot keys to toggle or press on / press off to toggle and these still work
They also have show() and hide() and visible properties or showControls() and hideControls() and controls property
These will still work as well.
Added a show(), hide() to ColorPicker to allow it to act like a pop-up like Pane, Waiter, ProgressBar and Keyboard
Added an optional container parameter to ColorPicker - ColorPicker can still be added with addTo(), center(), etc.
but if it is being used as a pop-up, the show() and hide() or toggle() should be used.
// BACKINGS and BACKGROUNDS
The term backing is now consistently used for a custom DisplayObject added to a component
(such as a Pizzazz shape or pattern)
The term background is now consistently used for a built in background rectangle
These are specified with the backgroundColor parameter for Label, Indicator, etc. objects
In the past, both backingColor and backgroundColor were used which was inconsistent.
BREAK Changed Indicator, Tabs, ColorPicker and TextArea backingColor to backgroundColor
Renamed the backing properties of these to background to access the rectangle
// DOCS
Changed the order of the modules as they appear in the docs
FRAME, DISPLAY, METHODS, CONTROLS, CODE, WRAP, META
In the actual file, wrap and code come first and frame second last
This is needed as wrap and code do not require CreateJS
But from a user standpoint, the Frame, Display, Methods and Controls are most important
Hopefully you will get used to it - and it will be a good change
Changed the text docs as well and adjusted search to work with new changes
Added SubSection Markers and reorganized items within modules
// GENERAL
BREAK - changed drag parameters to draggable - as conflicts with drag function style
BREAK - changed the name of the Label backgroundCorner to just corner (easier to style)
BREAK - Added a corner property to Indicator after backgroundColor
BREAK - Added a borderColor and borderWidth to Keyboard - so changes parameter order
BREAK - added a borderWidth property to Stepper and Indicator - this is after borderColor so breaks parameter order
Also made border work on Indicator background
Adjusted copy() to not break when cloning a null value
IMPROVEMENT Fixed Button rollPersist to work if release outside of Button
Added indicatorColor property to CheckBox and RadioButtons that defaults to color
Adjusted ColorPicker so color text does not shift when picked (due to changes in centerReg() functionality)
PATCH - fixed bounds of cloned Container without initial bounds set - thanks Ami for the find.
PATCH - fixed ColorPicker when not with all colors, lastColor was set to blue and now it is not
This meant that the change event would not fire if the first color chosen is blue ;-).
IMPROVEMENT - clone() now clones the type property
so if you change the type of a Rectangle and clone it, the clone will have the changed type
Handy for passing an object with a custom type="Pattern" in for backings in STYLE
Adjusted Keyboard so selectedIndex starts at the end of the label text - also fixed backspace at 0 index with existing text bug
Fixed animate() when running a series with as a global function with no target
the last change for overriding by default only if x and y are animating - was expecting a target - fixed now...
IMPROVEMENT - updated Button so when it has a backing or icon,
it removes the rollover state when enabled is set to false
Adjusted backing on Label to mask backings of type="Pattern"
Adjusted Squiggle and Blob to drop properly when scaled or rotated
WELCOME TO ZIM OCT!
A kids section is also being added to ZIM Skool for workshops and secondary school lessons
Please let others know about ZIM and we'd love to hear from you at https://zimjs.com/slack - very productive!
---------
Updated TypeScript zip at http://zimjs.com/typescript/zim_ts.zip
Updated Distill at http://zimjs.com/distill
Updated Templates at http://zimjs.com/frame, Tips, CDN and Docs
Created Blog Post at https://zimjavascript.wordpress.com/2018/08/28/naked-objects-style-on-the-canvas-with-zim-and-createjs/
And CodePen at https://codepen.io/zimjs/post/naked_objects_style_on_the_canvas
Updated Tips page at https://zimjs.com/tips.html
and Code page at http://zimjs.com/code.html and About at http://zimjs.com/about.html
ZIM 7.3.2IMPROVEMENT Added an optional titleBar on the top of Window like there is in Pane to drag and close and have a title...
also added properties to access titleBar and its parts and the close button - added a "close" event
IMPROVEMENT / BREAK changed the names of Window parameters for indicator to scrollBar - thanks Bracer Jack
IMPROVEMENT / BREAK inserted scrollBarH and scrollBarV parameters default true to show scrollBars if scrolling is needed
BREAK called Pane() bar parameters titleBar for consistency with new Window titleBar parameters
Window has scrollBar parameters too so needed to distinguish a titleBar rather than use bar.
BREAK Changed the Pane() name of the barTitle parameter to titleBarLabel
BREAK Adjusted ColorPicker to set greyPicker, alphaPicker, buttoBar to false by default if one row of colors
Added a read only colors property to the ColorPicker that returns the array of colors
IMPROVEMENT Added "rgba" option to convertColor()
and BREAK changed second parameter to be toColorType with default of "hex" and other values of "string" and "rgba"
added an alpha parameter for alpha of RGBA conversion
So convertColor(blue, "rgba", .1) would convert the ZIM blue to rgba(80,196,183,0.1)
IMPROVEMENT / BREAK animate() override now defaults to false instead of true
except if animating an x or y value and the object is currently animating in the matching x or y value
In this case, all earlier tweens will be overridden along with the x and y unless override is set to false
This forces the developer to use two separate tweens if the desired override settings are different.
Previously, all tweens on an object defaulted to override true - to solve almost exclusively an x and y animation issue
Adjusted Emitter() to centerReg() but not add as this was overriding the positioning of the emitter.
ZIM 7.3.1IMPROVEMENT Added dispose() to all display objects
And adjusted dispose() on existing display objects to recursively remove listeners and remove from parents
The references to the objects on the outside must still be set to null to set object for garbage collection.
Updated docs for dispose() on all Display Objects
IMPROVEMENT outline() now remains on object when dragged or gestured.
outline() does not come up over Keyboard - thanks Bracer Jack
IMPROVEMENT Drag, Gesture and Transform objects do not come up over Keyboard even with onTop true (TBJ)
Added a controls property to the transformControls that references the controls container.
Updated TypeScript, etc.
ZIM 7.3.0
PATTERNS
Introduced ZIM Pizzazz 03 - custom patterns and animated patterns
These can be passed in to Button, Pane and ProgressBar objects
using the backing and rollBacking, toggleBacking and rollToggleBacking, waitBacking and rollWaitBacking parameters
at which point the pattern will be masked to the button, bar, etc. size.
The patterns can also be used on their own or masked by Pizzazz 01 shapes or your shapes, etc. using setMask()
http://zimjs.com/patterns.html
COLORS
Added Frame colors to zim namespace - and also global namespace with default zns set to false
This means to use zim colors just use black, pink, faint, blue, clear, etc. with no quotes
PROGRESS BAR AND PROGRESS PARAMETER
Added a ProgressBar() class with default "circle" barType - also "rectangle" for traditional bar
BREAK Added progress parameter to Frame and LoadAssets after the path parameter
This can receive a ProgressBar or a Waiter.
BREAK Due to the new Frame progress parameter, it is important to specify colors as Frame parameters
so that the colors show when the progress is running - so these have been moved to before the assets parameter
Loading now defaults to XHR as true if there is a ProgressBar - this gets load data from preloading
Adjusted Waiter to not require a stage so it can be made and passed in to progress parameter of Frame and loadAssets()
which may happen before there is a stage in the case of the Frame progress parameter.
SERIES
IMPROVEMENT Added a makeSeries() function to the Code module that returns a function which returns values in series
This can be used with ZIM VEE (zik) values to force sequential values from an array (passed to makeSeries)
TILE CHANGES - IMPROVEMENT / BREAK
Adjusted Tile() so registration and origin are at top left corner of bounds
Previously these were at the first element's registration point - which was odd for tiling centerReg objects like circles
Added optional colSize, rowSize, align and valign parameter after spacings
Moved count parameter to after cols and rows - really tired of adding null for count all the time
This was added to match the format of importing a SpriteSheet which often has a count that does not match the tile count
So SpriteSheet will remain as is with the count before spacing. And Tile will have the count after spacing.
Added a clone parameter (default true) to end of Tile
Set this to false avoid cloning a series unnecessarily
DEFAULTFONT UPDATE - thanks Bracer Jack for the prompting
IMPROVEMENT Applied DEFAULTFONT size and color properties to:
Button, RadioButton, CheckBox, Pane, Tabs, Pad, Stepper, ProgressBar, Keyboard
Initially, the font (family) and various other properties were applied but size and color were dictated by the component
Now, all the properties of the default font settings are applied which could BREAK the look of the app
if you were using DEFAULT FONT (only a few versions old). These properties include:
size, font, color, rollColor, shadowColor, shadowBlur, fontOptions, outlineWidth, outlineColor, padding, shiftHorizontal, shiftVertical
align, valign are available for the Pane
BUTTON UPDATES IMPROVEMENT / BREAK
The Button now has complete parameters and properties for
1. label (text), backing, rollBacking, icon, rollIcon
2. toggle (text), toggleBacking, rollToggleBacking, toggleIcon, rollToggleIcon
3. wait (text), waitBacking, rollWaitBacking, waitIcon, rollWaitIcon
The backing and icon parameters are read only references to current objects
Use the new setBacking(type, obj) and setIcon(type, obj) to manually adjust these at any time
This makes sure that old references are removed and any patterns are applied properly
Added a rolled property to Button that is true when button is rolled over
Added a wait() method to force the wait state of the button (similar to existing toggle() method for toggle state)
Adjusted Button so gradient and gloss work with custom backings
MISC
Added a series([]) function that is the same as makeSeries([]) but shorter in name for styles
Added a placeTextColor parameter to Keyboard BREAK
Fixed a problem with the icons - required cloning the icons as the board is remade during state changes
Added expand() to close button on Pane
Added chainable setBounds() method to Container and all extending container that overrides the CreateJS setBounds()
Also supports alternate parameters - (size) (width, height) or (x, y, width, height)
Updated TypeScript zip at http://zimjs.com/typescript/zim_ts.zip
Updated Distill at http://zimjs.com/distill
Updated Templates at http://zimjs.com/frame, Tips, CDN and Docs
ZIM 7.2.0IMPROVEMENT / BREAK - changed Frame parameters to include assets and assetPath as the fourth and fifth parameters
This allows initial assets to load as part of the Frame's "ready" event - thanks Bracer Jack (TBJ) for recommendation
This solves the double event call that often confuses people new to coding.
While adjusting the parameter order, moved outerColor parameter to after color parameter.
Added a queueOnly parameter to loadAssets (default false) set to true to give asset events only to the queue and not to the frame
eg. var q = loadAssets(etc) // will give a complete event to q and to the frame
var q = loadAssets({etc., queueOnly:true}) // will only give a complete event to q - NOT to frame
BREAK - changed the addTo() method's new localToLocal parameter to default to true
This means that when an object is added from one container to the next, the x and y are adjusted so the object does not appear to move
If this behaviour is not desired then set the localToLocal parameter to false.
This only affects an object that has an existing parent. (TBJ)
IMPROVEMENT Adjusted the DEFAULTFONT constant to optionally receive a Label config object so defaults for any font property can be set
Added a resetBounds() method to the Methods module of ZIM to reset bounds if previously hard coded.
IMPROVEMENT Added an empty backing event to Keyboard to stop presses from slipping through. (TBJ)
Added shiftHorizontal and shiftVertical parameters to Label
Adjusted CheckBox and RadioButtons to work with valign center Labels for better alignment.
Adjusted outline() to clear itself if another outline is set so now, this can be called in a Ticker for instance.
and we don't have to keep saying it is a snapshot in time! Thanks Bracer Jack
Examples have been added to the docs.
BREAK - changed the default padding to Window to be 0 - set this with padding or paddingVertical and paddingHorizontal
Added a removeAll() method to Window to remove all current content from the content container and update indicators. (TBJ)
Also added a "replace" parameter to the Window's add() method to replace the current content with the new content (first parameter)
Updated TypeScript typings at http://zimjs.com/typescript/zim_ts.zip - updated Docs, Distill, Templates, ZIP and code page
ZIM 7.1.0
1. Updated animate() to use a props parameter rather than an obj parameter.
Changed the existing props parameter to cjsProps as that is for older transition values.
obj still works for backwards compatibility but has been depreciated.
This is a conceptual change - props better describes that these are the properties we are animating.
It will be a fairly wide-spread change so there will be many tutorials slightly out of date - oh well.
2. Added a Boundary() class to the code module to store x, y, width and height
This can be used in place of a createjs.Rectangle in most cases.
The createjs Rectangle is still available and has more features.
This is to avoid confusion between the ZIM Rectangle and the CreateJS Rectangle.
The ZIM Rectangle is a DisplayObject whereas the CreateJS Rectangle is a data class.
The Boundary class can be used to specify a boundary for drag(), gesture() and for a Physics world.
3. Depreciated the rect parameter for drag() and gesture() and replaced it with a boundary parameter.
The rect will still work for backwards compatibility
4. Changed dragRect() and gestureRect() to dragBoundary() and gestureBoundary()
the old method names are still available but are depreciated.
These methods are used to dynamically change the boundaries - which is fairly rare.
The change is to match the new Boundary class for specifying a data rectangle.
Thank you to Bracer Jack for the prompting and confirming our nagging concern over two Rectangle classes.
5. Added a Point() class to the code module to store simple x and y properties.
This can be used in place of a createjs.Point in most cases.
The createjs Point is still available and has more features.
6. Added a paused property to all DisplayObjects
This will be undefined if the object has not been animated
Once animated, paused will be false until the animation is paused at which point it will be set to true
If the animation ends or is stopped, the pause property will be set to null.
This will allow the animation to be toggled with obj.pauseAnimate(!obj.paused)
7. IMPROVEMENT - added circularBounds parameter to gesture to keep rotated circular objects within boundaries
8. Added a DEFAULTFONT constant to the controls module below ACTIONEVENT (thanks Bracer Jack for the idea)
This can be set to change the font across all components to whatever is specified
Fonts specified per component will override this default
DEFAULTFONT can be set to a custom font - frame.asset("myFont.ttf") for instance
9. IMPROVEMENT- fixed gesture to not move if move is false and are double pinching
This was a glitch when we introduced surround bounds
10. Fixed startBounds parameter for drag() when using DUO.
11. center() and centerReg() will default to the object's parent if there is a parent and no container is provided
Thanks Bracer Jack for the suggestion
12. Changed global variable zon to be true by default to show messages from ZIM
In CodePen the libraries are passed in separately, so zon is missing from the code
and people were not receiving ZIM messages like bad parameter warnings, etc.
So the default now is true and zon must be set to false to suppress messages.
13. Added an asset object to Frame's loadAssets() in format of {id:"string", scr:"file"}
The loaded file can be accessed by id such as frame.asset("string");
The path paramter works in the same way as usual.
Specifying just the filename is still available: frame.loadAsset("filename");
Then the file can be accessed frame.asset("filename");
but the optional asset object offers an abstracted solution if desired - thanks Bracer Jack for the prompting
14. Updated TypeScript Typings for Point, Boundaries, drag, dragBoundary, gesture, gestureBoundary, animate and StageGL
ZIM 7.0.2IMPROVEMENT can now load Sprites with CORS (cross domain) when using JSON parameter
JSON was passing string version of URL to Sprite which voided the image crossdomain settings
Also, ZIM now pre-parses the images array in the JSON to match frame.asset() images
So the exact path is no longer needed in the JSON - just a matching filename will do
This is handy as TexturePacker, etc. often export with just the filename
and previously, this would not run if the SpriteSheet file were stored in an assets folder for instance
unless the JSON was modified to reflect the path - now, this is not necessary.
Adjusted gpu setting of Frame to properly make Bitmaps (broke in version 7) - patched 7 and 7.01
The change in 7 was to support IE as IE does not have an ImageData() constructor
so ZIM 7 was adjusted to use the createImageData() method of the context2D of the currentFrame.
Well... when gpu is true... there is no context2D for the currentFrame
so now a new temporary canvas is used to provide the createImageData method ;-)
Added hitTestGrid() to StageGL
BREAK added a currentSelected parameter after currentEnabled (before corner) for ZIM Tab
currentEnabled now only determines if tab can be clicked again when already selected
if true, this will call the change event even though the selectedIndex has not changed
The currentSelected defaults to true to highlight the selected tab after clicking
if set to false then the tab does not stay highlighted - good for button bars - IMPROVEMENT
Version 7 tried to not highlight when currentEnabled was true but this broke the Pad
so the functionality was split into two parameters
setting currentSelected to false will automatically set currentEnabled to true
IMPROVEMENT Added bounds transfer to when container is cached - apparently this is fixed in next CreateJS version
Adjusted Blob and Squiggle to store an internal mySet rather than set property
as this was conflicting with the CreateJS set method when animating the Circle or Rectangle objects in the control container
Swapped default for zon to be true - to automatically give messages from ZIM unless set to false
Was making CodePens and missing warning messages from ZIM about bad parameters, etc.
Updated TypeScript Typings for Tabs and StageGL
ZIM 7.0.1IMPROVEMENT Changed stage.mouseX and stage.mouseY to e.stageX and e.stageY when applicable
to let desktop touch screens access value - affected Keyboard drag, Swiper and a few other components
Adjusted Emitter() to moveTo random position rather than lineTo for emitShape setting (fixing a glitch)
Added swiperpause event and pauseTime parameter to ZIM Swiper
Added hitTestGrid() to Stage and StageGL classes
BREAK - added a sensors parameter to Frame that defaults to false
set this to true to use the Frame's devicemotion and deviceorientation events
this was set to default to false to remove the "depreciated" warning in the Browser console
Added zta() global function that logs Arrays and Objects to the console as a table
this binds the console.table() method
IMPROVEMENT Fixed Dial continuous to dispatch change event only different than earlier value
Adjusted Pad to show tabs it has if passing in a tabs list of less than number for pad
Added zik to wiggle() for base, min and max amounts
so now these amounts can be adjusted by an outside function for dynamic ranges with one wiggle
Added Keyboard selectedLabel and selectedIndex properties and showPlace() and hidePlace() methods
Thanks James Barrett for the prompting and thanks again Frank Los for the Keyboard class.
Fixed TextArea clone() method to properly clone TextArea
Updated TypeScript files and added link to top of docs
// PATCH
Adjusted Sprite to be interactive with JSON file and image from remote sites with CORS settings to anonymous
Previously, had to make a custom CreateJS SpriteSheet and pass that in to Sprite
Fixed Container to keep non-hardcoded bounds after being cached
ZIM HEP (7)
Added a Keyboard() class to the Display Objects (thanks Frank Los for the design and code)
Keyboard works with Label() to provide single line editable text without needing the system keyboard
Added top() and bot() chainable methods to put object at top or bottom of container - thanks Ami Hanya for the recommendation.
IMPROVEMENT Added links to libraries at the top of the docs for SOCKET, GAME, PHYSICS, THREE, PIZZAZZ, PIZZAZZ 2
as well as made all these files consistent in introduction and documentation format (inside CDN files)
Launched Physics and Three as version 1.0 - Game and Socket were already version 1 and Pizzazz is different
IMPROVEMENT Added video links to Docs - a little button near view and bits at the bottom of each doc entry
IMPROVEMENT Added wheel event to Window for mousewheel scrolling - was using out-of-date events
Added a scrolling event to Window when it is scrolled
Added an HTML NodeList to ZIM loop() - see ZIM zet() to get a NodeList like $() in JQuery
Dedicated ZIM Portal to Stephen Hawkings - may he portal on!
Added Button borderColor property - thanks Chris Spolton!
Added an svgToBitmap() conversion function to META module to convert SVG to a ZIM Bitmap
Thanks Kenil Domadia for the recommendation
For Base64 Bitmap support made Bitmap update the stage after 50ms and then after another 50ms
this is because there is a delay in creating a Bitmap from data - thanks Ami Hanya for the prompting
All the changes are reflected in ZIM TypeScript Typings http://zimjs.com/typescript/zim_ts.zip
KEYFOCUS - IMPROVEMENT
Added a global KEYFOCUS constant to keep track of which component has keyboard focus
This is a system for all components with keyboard controls (set to active)
The first component made will set KEYFOCUS to itself
Anytime a component is used it sets KEYFOCUS to itself
Components have a keyFocus property that can be manually set
There is only one component with key focus
so setting removes key focus from the last key focused component
Added KEYFOCUS to TypeScript
If tabbing from one component to the next is needed, consider using ZIM Accessibility()
Made keydown change components only if component is on stage
POS()
BREAK inserted an index parameter to pos(x,y,container,index,add) - also now accepts DUO
Was going to make the default be adding to stage - but after some thought, decided not to
You must still explicitly specify the container
We had changed it but then were getting errors where things were showing up unexpectedly in score boards, etc
and it just seems a little too dangerous
ZIM GESTURE
Added onTop and surround parameters to ZIM gesture() - thanks Frank Los for the suggestions
surround currently does not work if rotate is true
Adjusted gesture() rect parameter to handle resized and rotated objects
This is an IMPROVEMENT but also slightly BREAKS code with old rect values
Here you specify the rectangle to contain the object - not the registration point of the object
So this is slightly different than the rect provided to ZIM drag
To accommodate this we have added an update parameter to the gestureRect
This defaults to true and Gesture will dynamically update the gestureRect as the object scales and rotates
Internally, it passes a false to the new update parameter.
GENERAL FIXES
Removed ColorPicker indicator if currentIndex is less than 0
Fixed grip on ColorPicker to be dragable by setting shape to mouseEnabled false so background is selectable
IMPROVEMENT - adjusted TextArea so readOnly parameter works
Fixed decimal values for Stepper - some values had micro additions - these have been rounded to the decimal number
Adjusted tabs so that if currentEnabled is true, clicking button leaves button on rollcolor - like a button would - good for button bars
Fixed stage property in waitModal for buttons, tabs, etc.
Fixed next mousedown and hold on Stepper when mouse not moved.
Made animate() return the target for chaining when ANIMATE is set to false.
Changed loop() docs for method to not include loop function functionality
but rather refer to the loop() function in CODE module
BREAK - changed the Squiggle borderDashedCommand to dashedCommand as the Squiggle has no border
Squiggle is no longer implements a ZIM Shape in TypeScript as it has no border
Adjusted outline of Label to show above backing and backgroundColor
Adjusted wiggle to not use animate with a Ticker if object does not have a stage
Adjusted Slider so inside setting properly centers the slider in bounds
Added JS document.Window and document.Blob references before overwriting with ZIM Window and Blob
ZIM 6.9.0IMPROVEMENT Added TypeScript Typings for ZIM.
This led to some slight organizational changes but nothing serious
a few additions and a few parameter changes as outlined below.
The Typings are complete but relatively untested so there may be type typos to work through
as there were over 1000 lines of unique definitions and 2700 lines of full definitions
that were created with a custom parser.
The Typings ZIP can be found here http://zimjs.com/typescript/zim_ts.zip
Added ZIM Stage and StageGL class for TypeScript typings
ZIM Stage has type and read only width and height properties given to it by zim.Frame
If ZIM Frame is used, there should be no use for ZIM Stage.
Also gave the stages the loop() method so we can loop through children of the stage like we can a ZIM Container
BREAK The following were adjusted as we went through the typings:
added a fileID property to Bitmap as an alternative id to avoid conflict with CreateJS Bitmap id
removed second rect from MotionController - there already was a rect when we added another rect.
adjusted Stepper prev and next properties to containerPrev and containerNext so as not to conflict with prev and next methods
changed TextArea focus() to setFocus() and hasFocus property to focus - for better consistency with other focus properties
changed Pages setSwipe() to setSwipeArray() so as not to conflict with Container property setSwipe()
changed Stepper loop parameter and loop property to continuous (like Dial) so as not to conflict with Container property loop()
MORE METHODS CONVERTED TO CHAINABLE:
Blob and Squiggle setPoints(), changeControl()
Label showRollColor()
Button setBackings(), setIcons(), toggle(), clearWait(), stopWait()
CheckBox setChecked(), RadioButtons setSelected()
Pane hide(), Window resize(), Waiter hide()
Loader resize(), TextArea resize()
GENERAL UPDATES
Added a fileType parameter to loadAssets() so can override CreateJS PreloadJS parser
Note - it acts on all files loaded so might have to separate loading to get a specific type to load
For instance, laoding a .d.ts file was parsing as sound rather than text - so pass in fileType:"text" to override
but you would need to do this independently from any other assets unless the other assets were text too.
Added vertical parameter to tabs - set to true to make vertical tabs or vertical button menus
Tabs now as a backingColor parameter for in behind when corner is set
BREAK - changed the order of the smoothStep parameters to (num, min, max) to match order in constrain() and others
updated smoothStep example and Noise examples at http://zimjs.com/noise/
Moved ZIM Tile from the Display to the Controls module.
Tile takes an existing Display object and tiles it much like Layout, Scroller, Emitter, etc. operate on existing Display objects
Being a Container, Tile still receives all the ZIM Methods.
Also adjusted Tile's code when mirroring non-zero registration objects
Replaced the mousewheel event in zil() to wheel as mousewheel is depreciated
Also added wheel event to Window with scrollWheel true (default)
adjusted docs for Scroller to a paused property instead of the typo pause - note: there is a pause() method
Made Dictionary remove() return boolean success
Adjusted TextArea to not give error when Frame allowDefault is true (patch)
Adjusted tag mode canvasID to not have random number on end - thanks James Barrett
Added a allowDefault property to Frame to turn off and on zil for expanding and collapsing frames
see http://zimjs.com/expand/index.html - thanks Chris Spolton for the idea
ZIM removeFrom() - now removes from parent by default - makes sense ;-)
Changed ImageData() to createImageData() in Bitmap to support IE - thanks Chris Spolton
Adjusted spurtfizzed and spurtdecayed to lowercase instead of camelCase
Adjusted cloneProps to remake bounds - otherwise they were linked (patch)
ZIM 6.8.1IMPROVEMENT Added immediate property to Parallax class layer object. So you can specify a starting value without damping to the starting value
IMPROVEMENT Added frame.visibleLeft, frame.visibleRight, frame.visibleTop and frame.visibleBottom properties to help position relative to window in "outside" mode
All other modes will have 0,0,stageW,stageH for these properties
This data changes for outside mode and can be used in a frame resize event to keep items like navigation in the window view
Added note about setting mouseEnabled of animation target before running animation as animate sets and resets to original after a small delay
So if you set the mouseEnabled to false right after an animate() call then it will be reset
IMPROVEMENT Added crossOrigin parameter to frame.loadAssets() with default of "anonymous" - this lets files be loaded from Amazon S3 for instance
if the right CORS set up is there - HEAD was added for fonts - see the Bucket Permissions and then CORS configuration
<CORSConfiguration>
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>HEAD</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
ZIM 6.8.0
Added ZIM VR class in the Controls to do side-by-side VR like in Google Cardboard.
This is quite an exciting system so have a good look over the docs and examples.
http://zimjs.com/code/vr
Added a depth property to Display objects to be used with the VR class (only at this time)
Added a dep() chainable method to set the depth property
Added device orientation event to Frame:
"deviceorientation" - fired as device orientation changes
eventObject.alpha holds rotation about the z axis (if device is flat) relative 360 orientation like a compass
eventObject.beta holds rotation about the x axis between -180 and 180 (tipped forward or backward)
eventObject.gamma holds rotation about the y axis between -90 and 90 (tipped left or right)
eg. frame.on("deviceorientation", function(e) {zog(e.alpha, e.beta, e.gamma)});
Added multiple parameter to Frame makeCircles() method to make ZIM Circles rather than a single Shape
Adjusted centerReg() to only add to default stage if container is not provided AND obj is not already added to a container (no parent)
IMPROVEMENT Adjusted setMask() to not set the mask when not added to the stage only when the mask is dynamic
IMPROVEMENT Since adjusting the setMask in 6.7.1 masks could only be set when added to the stage
This has now been fixed so that masks can be set when not yet added to the stage.
Fixed a typo bug introduced in 6.7.2 that broke RadioButtons IMPROVEMENT
Adjusted zob() so it does not give an error if a single undefined parameter is passed in
IMPROVEMENT And... there was a glitch in making it chainable - it is now chainable
IMPROVEMENT Re-adjusted the Loader.save() method to avoid a Google change of policy:
https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/GbVcuwg_QjM%5B1-25%5D
Now saves directly to a file rather than showing image in new window.
Thanks Frank Los for the heads up.
ZIM 6.7.5BREAK ZIM move() has been removed. Please use ZIM animate() instead with obj:{x:val, y:val}
ZIM move() was a convenience method that just took an x and y parameter and passed it through to animate().
Now with ZIM mov() it became too confusing to have both and move() was not really needed.
IMPROVEMENT Added an events parameter to animate (default false) set to true to dispatch "animation" events from the target
The "animation" event will be dispatched while the target is being animated. Thanks Ami Hanya for the recommendation.
Adjusted ZIM addTo(), center() and centerReg() to default to the adding to the first frame's stage if no parameters
So now circle.addTo(), circle.center() or circle.centerReg() will add to stage as long as there is one frame.
If there are two frames, it will get added to the first frame's stage so beware.
BREAK The centerReg() used to just center the registration and not add it to anything if there were no parameters.
Now, it centers and adds to the stage. To just center the reg, use centerReg(null, null, false);
It was quite rare to just center the reg and not add it to a container.
And it was important to keep the addTo(), center() and centerReg() defaults consistent.
Added container and add parameters to ZIM pos()
For now, the container property defaults to null.
We will consider defaulting to the first frame's stage (if not already added to a container) in the future.
The add parameter defaults to true and could be set to false to not add to the container.
Thanks Kate Xue for discussion.
ADDED TO LABEL: (thanks Daniel Loranz for the prompting)
backgroundColor - (default null) set to CSS color to add a rectangular color around the label
The background color will change size to match the text of the label
Note: the backgroundColor is different than a backing which can be any Display Object
and background parameters are ignored if a backing parameter is set
backgroundBorderColor - (default null) the background stroke color
backgroundBorderWidth - (default null) thickness of the background border
backgroundCorner - (default 0) the round of corner
backgroundDashed - (default null) set to true for dashed background border (if backgroundBorderColor or backgroundBorderWidth set)
padding - (default 10 if backgroundColor set) places the border this amount from text (see paddingHorizontal and paddingVertical)
padding parameters are ignored if there is no backgroundColor set (also ignored if a backing parameter is set)
paddingHorizontal - (default padding) places border out at top bottom
ALSO added background property for the label to access the ZIM Rectangle that is the background
ZIM 6.7.4
Adjusted slidestop to work in Swiper if there is no min and max.
Updated Dial, Swiper and MotionController enable property to use event variables when adding the events.
Updated the transform show and hide to use event variables when adding the events.
Eg. INITIAL SETTING:
var eventID = that.on("mousedown", eventFunction);
DISABLE:
that.off("mousedown", eventID);
ENABLE:
// was doing:
that.on("mousedown", eventID);
// should be:
eventID = that.on("mousedown", eventID);
This does not affect one enabled = false then one enabled = true.
But after that, the next enabled = false will not work.
If there is another enabled = true then there are two events, etc.
So this has IMPROVEMENT possibilities.
At some point, this concept was lost and now it has been found again.
ZIM 6.7.3
Updated gesture to fix bug when setting rotate or scale to false - thanks 王晓东 / Sheldon Wang for the find
Added a hasFocus property to TextArea to get or set focus with property - there is already a focus() method to set focus.
Made the default cursor for cur() be the "pointer" - set cur("default") to go back to normal cursor, etc.
ZIM 6.7.2
Updated Blob and Squiggle points and controls property.
Blob and Squiggle had their points parameter array set with Number positions
The points property was initially read only for an array of point objects - the control container, circle, and rectangles
This was fine until we introduced the TransformManager and added the Blob and Squiggle.
At this time, we needed to be able to recreate blobs and squiggles.
We made points settable with an array in the same format as the points parameter.
This left the points property with different formats for getting and setting - not ideal.
So this change has fixed the issue and makes point manipulation easier and more consistent.
BREAK - IMPROVEMENT the points property is now consistent in format for both getting and setting with x and y properties (and a control type):
points - [[controlX, controlY, circleX, circleY, rect1X, rect1Y, rect2X, rect2Y, controlType], [etc]]
A new property has been added to get access to the zim objects for each point:
pointObjects - [[control, circle, rect1, rect2, controlType], [etc.]]
Here, control is the container; circle, rect1 and rect2 are Circle and Rectangle objects
Note, the order is now the same for consistency
We were also using the term "set" to represent the controls of one point.
This starts getting confusing when we get and set values as we are using the word set again. (Thanks Kris Gardiner for the advice)
So we now use control to refer to the controls at the point - control is the container that holds the circle and the two squares
BREAK - the sets property has been changed to controls which provides access to the overall container that holds all the control containers
BREAK - controlsVisible is now the Boolean property to get or set the visibility of the controls - this was formerly controls.
Added an update parameter to Blob and Squiggle changeControl() - defaults to false to let multiple changes be batched with update() method
Fixed canvasID for tag mode - Thanks Alex for the report
Updated ZIM Label to be able to store a space and return text of a space.
Adjusted ZIM animate to use ZIM VEE values for sequences.
ZIM 6.7.1
Added chainable cache() method to Containers and Sprites - this overrides CreateJS cache to operate on bounds by default and return the object for chaining
so all Display Objects that extend a Container such as Circle, Rectangle, Triangle, Blob, Squiggle, Label, etc. all get the new cache()
eg. var circle = new Circle(100, frame.red, frame.dark, 5).cache().drag();
cache() will automatically cache the dimensions of the Circle, Rectangle, etc. and add the half borderWidth as well - NOTE that cache is chainable now!
You can still pass in dimensions and if you do, you can just pass the first two parameters as width and height to start x and y at 0.
Or you can pass all four parameters like CreateJS cache() - note, the fifth parameter is scale which can cache at a higher fidelity for later scaling
This is a convenience function for circle.cache(-circle.radius, -circle.radius, circle.radius*2, circle.radius*2);
Added a cur() chainable method for applying a cursor to a CSS cursor string value
eg. var circle = new Circle(100, frame.red, frame.dark, 5).cur("pointer");
This is a convenience function for circle.cursor = "pointer"
The function itself in ZIM is virtually nothing:
zim.cur = function(type) {
obj.cursor = type;
return obj;
}
But it allows us to chain and potentially avoid variable names - for example:
var circle = new Circle().center(stage);
circle.cursor = "pointer";
circle.on("click", function(){zgo("http://zimjs.com");});
// becomes 70% the code with:
new Circle().center(stage).cur("pointer").on("click", function(){zgo("http://zimjs.com");});
// remember that on() does not return the object for normal chaining but that is okay if no further reference to the object is needed
// albeit, risky if you change your mind...
Added a sha() chainable method for applying a createjs Shadow() that has defaults or params for color, shiftX, shiftY, blur or a single CreateJS Shadow
eg. var circle = new Circle(100, frame.red, frame.dark, 5).sha().drag();
This is a convenience function for : circle.shadow = new createjs.Shadow("rgba(0,0,0,.3)", 5, 5, 10); // etc.
Updated gesture() and transform() to work properly with masking as well as converted drag(), animate() and Blob() into new mask management
Added a dynamic parameter (default false) to setMask() that runs a Ticker to track and update mask movement.
The Blob and any ZIM Shape that has drag, animate, transform or gesture will set the dynamic property to true (unless it was explicitly set to false)
A Shape() that is used for a mask does not have to be dynamic as it is directly applied as the mask
If you are going to mask with a ZIM shape (Rectangle, Circle, Triangle) and then manually transform the mask for instance, mask.sca(2);
then either setMask with dynamic of true or setMask after the transformation
BREAK - IMPROVEMENT - made setMask() return object for chaining - now that dynamic is set no need really to return mask object instead use mask.zimMask
BREAK - Added count (total tiles) parameter to after cols and rows for ZIM Tile - in case you do not want all columns filled on last row.
Added factor parameter to Swiper (default 1) is going the same direction and -1 is going in opposite direction
Updated Swiper to recognize damp parameter
Added swipestop event to Swiper for when motion stops after swipeup
Adjusted added() method to clear longer interval if shorter interval detects stage
Adjusted Blob and Squiggle to not check for stage updates when not on stage due to removeFrom stage - was working fine for toggle but not if manually removed
Added slidestop event to drag() docs
ZIM 6.7.0
Added devicemotion event to Frame - eg. frame.on("devicemotion", function(e) {zog(e.acceleration.x, e.acceleration.y, e.acceleration.z)});
Added Portal(obj, lands) to controls module.
Portal lets you travel between lands (screens, etc.) by rolling over an object - the portal.
It handles masking the land through the portal and the land management - dispatches enter and exit events
Here is an example http://zimjs.com/code/portal
BREAK - changed "relative" parameters and properties in Dial to "continuous" for better clarity - and continuousMin and continuousMax
ZIM 6.6.4IMPROVEMENT Adjusted Dial and Slider keypress to be independent of other keydown commands (like MotionController)
Added keyArrowsH and keyArrowsV to Dial and Slider that default to true - can now turn off left/right or up/down control
Fixed arrow control on limit=false to allow multiple revolutions
Fixed arrows on relative setting of Dial
Fixed ticks for slider with max that is smaller than min
ZIM 6.6.3
Adjusted docs to say Dial has default step of 1 (not 0 as docs had said).
Added multitouch to Dial - Slider and drag() already have multitouch.
Added relative, relativeMin and relativeMax parameters to Dial
Added relativeMin, relativeMax get set properties to Dial and made min and max writeable for when relative is true
This uses max-min as amount per revolution and continues to add or subtract accordingly
http://zimjs.com/code/etch/ for Etch A Sketch example
ZIM 6.6.2IMPROVEMENT Added raw() method to zim.Ticker() that directly adds a function to a requestAnimationFrame
Also added a removeRaw() method to remove a raw function with an id made by var id = Ticker.raw(function)
This gives ultimate speed without calling the library system of Ticker.add()
Ticker.add() should still be used in general for multiple ticker calls or calls along with zim animate, etc.
But use raw() for dynamic art for instance where you have one butter smooth ticker.
You need to call stage.update() in the raw() function
We could have called stage.update() but it would run the risk of duplicating the update if the coder also put it in
Updated Scroller to add second object to the same layer as the original object
so no need to add Scroller objects to containers IMPROVEMENT
Added flip and flipVertical parameters to Dynamo to flip the Sprite if speed is negative and reversible is false.
This was done by the coder previously - so it might BREAK a project where it was already done... BREAK
Also changed reversable parameter to reversible for proper spelling ;-) BREAK
Added convertColor() to DISTILL
Adjusted DISTILL to properly access ZIM namespace without ZNS set to true
Adjusted Frame to create a random canvasID if the frame is not the default frame and no canvasID is provided
Added canvasID property to Frame to provide String of the canvasID - could also use frame.canvas.id
Fixed glitch in makeID() so default is indeed mixed
ZIM 6.6.1
Added isJSON function to test for JSON string.
IMPROVEMENT Adjusted ZIM gesture to rotate and scale around pinch point.
Added regControl parameter (default false) to gesture go back to rotating and scaling around registration point.
Fixed chaining of stopAnimate and pauseAnimate.
ZIM 6.6.0
DOCS:
Removed namespace from documentation titles and doc examples
Remember that the namespace can still be used. It can also be required by setting zns=true before importing ZIM
Tidied up the function listings to not include title = function(parameters) but rather title(parameters)
Added a text version of the docs for easy import into other viewing systems like PDF (thanks Vishwas Gagrani)
SQUIGGLE:
Added ZIM Squiggle - like a blob but only a line
Squiggle has pretty well all the blob features including TransformManager support
Squiggle does not have borderColor, borderWidth nor radius but rather has color, thickness and length
It also defaults to "mirror" as the type of control rather than "straight" which the Blob defaults to
BUTTON:
IMPROVEMENT - added wait, waitTime, waitColor, rollWaitColor, waitTextColor, rollWaitTextColor, waitModal, waitEnabled parameters to the end of the Button parameters.
Added clearWait() and removeWait() methods, a waiting property and a waited event which is dispatched if the waitTime is reached.
For wait backings and icons use the setBackings() and setIcons() methods along with the waited event to handle changes.
BREAK - inserted a borderRollColor parameter before borderWidth which is before corner.
Any existing buttons with traditional parameters up to corner will broken - an extra null will have to be inserted before borderWidth.
Also added a borderRollColor property to the zim Button.
Since the parameter order has changed, moved dashed to after flatBottom parameter - to match Rectangle.
Added wait parameters to Tabs and Pad as well and added gradient and gloss to Pad
PANE:
Added the following parameters to ZIM Pane()
bar - (default null - no bar) a String or ZIM Label title for the pane that will be presented on a bar across the top
barColor - (default "rgba(0,0,0,.2)") the background color of the bar if a bar is requested
barHeight - (default fit label) the height of the bar if a bar is requested
close - (default false) - a close X for the top right corner that closes the pane when pressed
closeColor - (default #555) - the color of the close X if close is requested
Also added bar, barColor, barBacking, and close properties to access these objects
Fixed TextArea and Loader inside Pane add/removal problem - was using Dictionary objects list rather than values list
Also for multiple TextAreas was not looping through container backwards when removing so was missing an item
BREAK changed the backingAlpha to backdropColor to offer more flexibility for the backdrop
use "rgba(0,0,0,.5)" etc. for dark and "rgba(256,256,256,.5)" for light - and of course colors as well.
You can use a solid color and then drop the alpha with pane.backdrop.alpha = .2 - not alp() as backing is CreateJS shape.
HITTESTCIRCLES:
IMPROVEMENT - added ZIM hitTestCircles() method to all display objects.
This tests if two circle shapes are hitting using an equation based on cirles made from bounds
If the bounds are not square, the circles are averaged - the radius is half the average of the lengths of its sides
(This is different than hitTestCircle() where the points around the "circle" actually stretch to an oval with the bounds)
obj.hitTestCircles(obj2) is a calculation based on intersecting circles so is faster than shape hitTests
It will be as fast as hitTestBounds and hitTestGrid.
hitTestCircles second parameter is a margin number value which can be positive or negative to tweak the hitTest
A margin parameter has been added to hitTestBounds as well before the boundsShape
OTHER:
IMPROVEMENT - added zim.previewAudioSprite() to the META module to create tabs with each sound in an AudioSprite for easy preview
Adjusted parseAudioSprite() to clarify that it returns a CreateJS AudioSprite object
BREAK - adjusted Blob to have a setData() method rather than a set() method so the general set() method is not obscured
BREAK - adjusted transform() transformObject to have a setData() method rather than a set() method to be consistent with Blob and Squiggle
NOTE: transform has a transformObject which is a custom object - not a Display object so set() is fine there but wanted to be consistent
BREAK - adjusted Blob and the transformObject to have recordData() methods rather than record() methods
These now match - recordData(), setData(), recordPoints(), setPoints() - sorry for the adjust but should be settled now.
Also adjusted the Docs on Blobs to update the single click edit.
Also adjusted the Docs on the Blob's points property to indicate a different format for setting and getting points.
Adjusted TextArea and Loader to use zim.added() to test for the stage and then on("added") to test for re-adding after
Fixed a glitch in Stepper so the downForward parameter works as expected
Added read only num property to Blob (to match Squiggle's num property) for number of points
Added error support for font loading so load completes if font is missing - takes the timeout though of 8 seconds
which is not ideal but could not seem to capture immediate bad URL error with error or fileerror events
Fixed Stepper to set correct selectedIndex when stepping through number list that does not start at 0 and make sure enabled has this number when set to true
Gave Pane and Indicator enabled properties like most other components
IMPROVEMENT - adjusted TextArea to have a background-color of rgba(0,0,0,.01) so cursor and selection highlight shows up (was at transparent - weird that would affect selection)
IMPROVEMENT - adjusted zim.drag() so the last drag added is the only drag on the object
IMPROVEMENT - added a dynamically created audio tag for the first audio loaded to jumpstart audio on some Apple devices
Thanks Bart Libert for reporting and testing the issue.
ZIM 6.5.0
AUDIOSPRITES:
IMPROVEMENT Added support for AudioSprites with frame.loadAssets() and frame.asset()
Added outputAudioSprite parameter to loadAssets() to show converted AudioSprite data when using ZIM AudioSprite format
Added parseAudioSprite() function to META section for parsing AudioSprite data from https://github.com/tonistiigi/audiosprite
TRANSFORM, BLOB and TRANSFORM MANAGER:
Added a transformType property to the transformed event object for transform()
This has values of "scale", "move", "rotate", "stretchX", "stretchY", "reg" "reset"
Added objects and persistID to the start of ZIM TransformManager() parameters
BREAK The unique parameter has been removed now that transform works with single click
Added currentObject and persistData properties to TransformManager
Added EVENTS to TransformManager:
1. transformed event when pressup on any of the controls or on click
transformed event object has transformObject and transformType properties
the transformType property has values of:
FOR TRANSFORM: "size", "move", "rotate", "stretch", "reg" "reset"
FOR BLOB: "move", "bezierPoint", "bezierHandle", "bezierSwitch"
2. transformshow and transformhide events for when click to hide or show controls
these have a transformObject property to indicate what was shown or hidden
Added a dispose(removePersist, removeControls) method to TransformManager
Added a dispose() to the transformControls for any transformed object to remove transform controls and events
Made Blob and transform / TransformManager only trigger change or transform events when a property value changes
Previously, a change would happen on mousedown and pressup but now there has to be a different x or y
Same with all handles, scaling, rotating, reg, etc.
SHAPE BITMAP and GRADIENT FILLS:
IMPROVEMENT - added colorCommand and borderColorCommand properties to ZIM shapes (Circle, Rectangle, Triangle, Blob)
These allow you to set Bitmap, linearGradient and radialGradient fills on the shapes (through CreateJS Graphic objects)
Thanks Samual Jacquinet for the prompting!
OTHER UPDATES:
Fixed Waiter.dispose() method when short wait times - thanks Ami Hanya
zim.hitTestPoint, hitTestReg, hitTestRect, hitTestCircle got a new last parameter - boundsCheck (default true)
Set this to false to not do a bound intersection check first
This would be slower but if the bounds are wrong (such as with blobs) the parameter should be set to true
to make sure that only the shape is used and not filtered by the faster bounds test.
Adjusted ZIM Blob to fix bounds issue due to above.
BREAK - no longer clone the cursor property when cloning an object - that can lead to unexpected results - but let us know if you disagree
ZIM 6.4.1IMPROVEMENT fixed memory leak in transform() that was leaving mousemove events due to using wrong variable name
IMPROVEMENTBREAK removed dblclick parameter and replaced with toggle parameter for single click editing
This is much more intuitive and has been set to a default of true.
So click on shows controls and click off hides controls.
IMPROVEMENTBREAK changed dblclick parameter for zim.Blob() to toggle to match transform()
Also changed Blob to single click to show and hide controls.
IMPROVEMENTBREAK made blobs drag when controls are active to match transform() and most editing tools
and changed dblclickDrag parameter to move to match transform() and default move to true (set to false to turn off dragging)
IMPROVEMENTBREAK added a handleSize parameter to Blob just before the toggle parameter that sets the handle size like with transform
This defaults to 20 on mobile and 10 on not mobile ;-)
BREAK changed the record() method of Blob to recordPoints() which matches format when creating a Blob
IMPROVEMENT and then added new record() and set() methods that work together for updating already created Blobs
This was so that Blob objects can be added to the zim.TransformManager just objects with transforms
You will need to make a basic Blob with the correct number of points.
Also added a setPoints() method that sets the points of an existing Blob that match the recordPoints
Strategy - if you want to create Blobs from data use the recordPoints and pass that data into the points parameter.
If you want to adjust an existing Blob then use the setPoints() method
If you want to record more than just the point data - for instance, x, y, color, etc. then use record() and set()
Or let the TransformManager handle it - it uses the new record() and set() similar to the transformControls record() and set() methods.
Also adjusted zim.setMask() to help handle dragging of a Blob object as a mask and added an example to the setMask docs
as well as an update to the snake at http://zimjs.com/code/zoo.html
Updated the other animals too including adding clone() to lion assets for multiple lions, putting snake into a function for multiple snakes
IMPROVEMENT - made zim.TransformManager also handle Blob objects as mentioned above - including the saving of, resizing and handling show and hide
Added getQueryString() method to return the HTML query string ?var=val&var2=val2 as an object with matching properties
Thanks Ami Hanya for the suggestion.
IMPROVEMENT - added loadTimeout parameter to frame.loadAssets() with a default of 8000ms - this is how long to wait for assets
Thanks Jonghyun Kim for suggestion and to CreateJS for already having that in the LoadQueue
IMPROVEMENT - adjusted frame.asset() to have a default "Broken Image" object (ZIM Circles) when asset is not available.
This can be adjusted with the new loadFailObj parameter for zim.Frame() - the object will have a type property of "EmptyAsset"
Also made loadAssets() accept a ZIM DUO configuration object.
Made loadAssets() work with files without extensions.
ZIM 6.4.0IMPROVEMENT Added font support to zim.loadAssets() - for urls to fonts and also Google fonts
Pass in font in format {font:name, src:url, type:string, weight:string, style:string}
Any number of fonts can be passed in along with images, sound, etc. to loadAssets()
The name is what you give it and you would use that name in a zim.Label({font:"name"})
If you use http at the start of the font src it ignores the path parameter for that font
This allows you to use your own fonts in a directory but also add google fonts in the same loadAssets.
This piggy backs on CreateJS FontLoader() but consolidates the format and combines with other assets to load
Added a backdropClose parameter to zim.Pane() - thanks Ami Hanya for the prompting
BREAK moved the container parameter to the end of zim.Pane as most panes are added to the stage.
In the past, ZIM did not know the stage but now it has a ZimDefaultFrame with its stage
ZIM 6.3.3
UPDATED all ZIM Bits to version 6.3.3 using chaining, no namespace and loop throughout.
Would recommend, this way of coding - see http://zimjs.com/code/tips.html
Note: The ZIM Capture video series has not been updated and probably will not be.
BREAK the scale() method has been depreciated and removed - use sca() which works the same way
The new CreateJS has a scale property so ball.scale = 3; will set both scaleX and scaleY.
It appears that scale will read the scaleX. So, no more scale() method in ZIM.
Instead you can use sca() for chaining and then scale, scaleX and scaleY for properties.
BREAK - changed parameter order for TextArea and Loader - sorry - moved frame parameter to end
We now have zimDefaultFrame which will do in most cases and if we are in a second frame then pass that in to the frame paremeter
Added focus() property to TextArea (thanks Armin for the prompting) before was textArea.tag.focus() piggy-backing on JS focus of HTML tag
Adjusted OPTIMIZE, ANIMATE and DISTILL constants to work without the zim namespace with zns false - accidentally made them work when zns was true (so swapped)
IMPROVEMENT Fixed a glitch in run() method of Sprite() to allow for replay of non-label Sprites
since the change to normalized playback supporting non-sequential frames in SpriteSheets animations
Adjusted zim.place() to return object for chaining
IMPROVEMENT Adjusted zim.Rectangle to draw a normal rectangle if the corner is 0 was drawing a rounded rectangle with corner 0
then realized the border was not mitred as expected - it had little rounded corners instead of 90 degrees.
Updated zim.Accessibility() to put a z-index back to -5 that was accidentally left at 5 for testing. Thanks Frank for the find.
ZIM 6.3.2
Added split property to Parallax object to center the input value (with mouseX this defaults to true - the others false)
Thanks Raman for the prompting! IMPROVEMENTBREAK Adjusted Parallax parameter order to layers, damp, auto, stage and give the object the default frame's stage
With the scrollX, scrollY chrome fix, this is a good time to adjust the stage parameter - it is the last of the ZIM classes left requiring a stage since the default frame addition.
This was primarily due to parallax being its own module without Frame - but now ZIM has Distill, so it is not that big a deal to loose parity with the old stand-alone parallax module.
Fixed mouseY to use stageH as default inMax rather than stageW (bug)
Adjusted scrollX and scrollY to test for document.documentElement && document.documentElement["scroll"+side]) || document.body["scroll"+side]
Before was assuming Safari only used documentElement and Chrome, Edge, Firefox worked fine - then Chrome seems to have changed its mind...
The Chrome change will BREAK any previous Parallax scrolls with scrollbar (not mouse) so if you made one, upgrade to this ZIM and it will not be broken.
IMPROVEMENT And newer ZIM has a Frame parameter called allowDefault - set that to true to let mobile scroll on canvas.
Any old Sprite work with Parallax, will probably need to set {spriteSheet:spriteSheet} as that parameter position changed a while back.
ZIM 6.3.1
Added cache parameter to transform() and automatically cache the handles and cursors unless set to false
Added a outerColor property to ZIM Frame() to set the color of the HTML body (background-color style)
Added outerColor parameter to the end of the ZIM Frame() class
Adjusted tweek in Sprite.run() to handle non-label input - that got lost with a previous change. IMPROVEMENT
Added startType parameter to wiggle() defaults to both but can set to positive to start positive or negative to start negative
Added onTop parameter to Blob so dragging it when controls gone defaults to brining the shape on top but can set to false to avoid this
Added snapToPixel parameter to Tile that defaults to true - this helps moved Tiles not have tiny gap
And added Tile parameters to documentation ;-)
Fixed Blob() and transform() to work with dblclick on mobile to toggle edit mode. IMPROVEMENT
ZIM 6.3.0
Created a transform() method for display objects that makes resize and rotate with little square handles, etc.
Added a TransformManager() class to handle multiple transforms and save / load data.
This is quite spectacular and is heading towards visual editors - perhaps even for ZIM HEP (7).
Thanks Ami Hanya for the idea and the prompting - hope this helps!
Made centerReg and outline return obj even if bounds not set (logs a warning)
Added stage.preventSelection = false; if frame's allowDefault parameter is true IMPROVEMENT
This fully allows mobile swiping, etc. to scroll a page when on the canvas (thanks Jonghyun)
The Manager lost its resizing when moved to support the new ResizeManager - that is back.
Fixed remove for one object in Manager
Switched zimify() to require third parameter true for adding scale - will be depreciating scale() due to conflict with new CreateJS 1.1
Start using sca() instead.
ZIM 6.2.2
Added frame.red to colors (thanks Alexa!)
Fixed glitch in Sprite.run() with wait, waitedCall, waitedParams.
These were just being passed through to zim.animate() but were left all as wait property names - oopsy.
Added pauseAnimate() and stopAnimate() methods (and functions) to basically replace pauseZimAnimate and stopZimAnimate
This depreciates the last two - which were titled that early on as dynamic methods before ZIM 4TH methods
All dynamic methods and properties had ZIM in them to avoid conflict
but now that methods are common, there is no need for ZIM in the method name ;-).
Fixed scale() which was turned off for glitch with setMask
Traced it to a possible conflict with canvas scale() method only with new CreateJS 1.0 and if other interactivity! - weird.
So scale() is back - all is well.
ZIM 6.2.1
Updated defaults for mic with SoundWave for baseline (0) and magnify (1).
Also cut the value off at 0 as it was going negative due to changes in ZIM 6.1.1
Glitch in zimify() when applying scale() - might be conflicting with CreateJS Shape and Canvas scale() method?
So removed scale() from zimify() - use sca() instead.
Adjusted ZIM Pages to set pages to original alpha rather than 1 after a transition.
ZIM 6.2.0
Updated ZIM to work with createjs.min.js the new CreateJS 1.0.0. IMPROVEMENT
There were a few minor depreciations to take care of:
getStage() became stage, setPaused() became pause, getNumChildren() became numChildren
These were like that to support versions older than 2015 but there is no real use in that now.
Note the gpu parameter of Frame that defaults to false.
Set this to true to use StageGL which is the major part of the release.
See bubbling video when we were preparing for this: https://www.youtube.com/watch?v=fUjyUpYdsM8
Added zim.Noise() class that makes OpenSimplex noise for art, terrains, etc.
http://zimjs.com/code/noise/
This is part of the Code module along with Damp and Proportion, etc.
Added a zim.Tile() class to let you tile an object (or objects with a ZIM VEE value).
You can choose set col and row parameters, add optional spacing and mirror as you tile.
This extends a zim.Container() and is part of the Display module.
Added a zim.smoothStep(min, max, input) function to the code module.
This takes an input value and outputs a value between 0 and 1
that represents a transition between the min and max with easing at both ends.
If you want the easing to be more pronounced, then reduce difference between min and max.
If the value falls outside the min or max it is set to the min or max.
Remember the return value is between 0 and 1 so you can multiply by max-min and add it to min
to get a value at the original scale.
IMPROVEMENT added drawImageData() method and imageData property to zim.Bitmap().
This allows you to draw pixel data into a Bitmap as you can with raw Canvas.
There is also reference to the proxyCanvas and the proxyContext for the canvas the Bitmap uses as source.
BREAK - there are new width and height parameters for Bitmap that come before the id parameter (breaks order).
ZIM 6.1.1IMPROVEMENT Made Sprite.run() work with non-sequential frames and nested labels and next calls
(see CreateJS SpriteSheet docs for format of animation data - which can be specified in a JSON file).
The Dynamo was already working with these and now the run() method does as well.
Adjusted cloned sprites to have different default ids - as pauseRun() was pausing all cloned sprites ;-)
Made pauseRun and stopRun chainable.
Added a flowthrough override for zik() by passing value as {noZik:value}
which allows arrays and functions to be passed through as a value rather than something for zik to process.
Updated SoundWave with the following IMPROVEMENTS to the parameters:
baseline - removes this amount of amplitude from each data point (after operation is applied)
magnify - multiplies the data point by this much (after the baseline is removed)
reduce - subtracts this amount from each data point (after magnified)
ZIM 6.1.0IMPROVEMENT Made zim.Accessibility work on iOS and mostly on Android - Stepper, Slider, Dial and ColorPicker still need work
BREAK - changed applicationName to appName, and highlight to alwaysHighlight and the parameters following are prefixed with AH
This is a solid week of programming for iOS Voice Over - visit on Slack for learnings and advice
Still untested on stand-alone screen readers but good on Windows Narrator, and the mobile readers.
Added currentValueEvent properties to Slider, Dial to get or set value and dispatch event if set changes value
normally, if we are setting a value with code, we can do whatever we would do in the event at that time
but with accessibility, on mobile, the options are being set by HTML and we want to trigger the event
Added a text property to the RadioButton button containers
Added a zim.ResizeManager() that extends zim.Manager and handles resizing Accessibility, Layout, Pages, Grid, Guide, TextArea and Loader
This is just a small class - a few lines of code.
Note - the Accesibility resize() will call any loader or text areas inside it...
BREAK Added decimals parameter to Accessibility before frame parameter
BREAK for the following:
Adjusted Stepper type parameter to stepperType parameter to avoid conflict with new type property for all Display Objects
Adjusted CheckBox type parameter to indicatorType parameter to avoid conflict with new type property for all Display Objects
Adjusted Dial type parameter to indicatorType parameter to avoid conflict with new type property for all Display Objects
Adjusted Indicator type parameter to indicatorType parameter to avoid conflict with new type property for all Display Objects
BREAK - changed buttons property of RadioButtons to an array rather than container - to match buttons array in Tabs and Pad
Made points property of Blob read and write instead of just read
Added functionality for selectedIndex and stepperArray of Stepper to work with "number" stepperType
Changed currentIndex to selectedIndex for Stepper - BREAKS - matches property name with other components (sorry)
Updated docs for TextArea to include size parameter which was there all along...
Adjusted Dial docs to read default 1 for step.
ZIM SIX 6
Made ZIM Accessible - IMPROVEMENT
Added zim.Accessibility() class to handle tabbing to any ZIM Display Object and send messages to Screen Readers
http://zimjs.com/code/screenreader has a detailed example
You basically pass zim.Accessibility() an array of objects (with optional titles)
These will be tabbed to if they are on the stage and the title or a default title sent to the Screen Reader
There is also a talk() method to be able to send a message to the Screen Reader at any time
Gave all ZIM Display objects a type property that matches the class name as a String (case sensitive)
BREAK - removed former (marked as temporary) work with tab order in Tabs, Stepper, and Frame - this is all replaced and updated in zim.Accessibility()
IMPROVEMENT Adjusted Window to handle removing of Window while being rolled over (thanks Frank Los for the bug report)
Added SLACK support discussions https://zimjs.slack.com
Removed clone override from Swipe, Frame, and a few others that did not need it - just an oversight
indicator.currentIndex is now constrained from -1 to num-1 where num is the number of lights
Added readerDecimals parameter to Slider and Dial with default 2 decimal places the screen reader will read
Added keyArrows parameter to Slider, Dial and ColorPicker for arrow key usage if in focus
Added keyArrowsStep parameters to Slider, Dial so Screen Reader does not read all the decimals
Adjusted bar of slider for positioning when pressed - was half a step off due to button registration change - IMPROVEMENT
Also expanded hitArea on bar - IMPROVEMENT
Added spellCheck parameter to TextArea - default true but can set to false
Added an allowDefault parameter to zim.Frame that passes value through to CreateJS Touch.enable() method's third parameter
Note: the third parameter does not seem to be working so an issue has been added to CreateJS GitHub - thanks Jonghyun Kim for working on this with us
https://github.com/CreateJS/EaselJS/issues/898
This will also prevent Frame from using zil to keep the canvas still
You can set allowDefault to false and then manually remove the zil events for specific key or scrollwheel functionality
Although the ZIM namespace was removed in 5.5.0, it will be handy to remember that from version 6 on, the ZIM namespace is not required
ZIM 5.5.0
Added zimplify() global function. Note - this is different than zimify()
zimplify() removes the requirement to use the zim namespace IMPROVEMENT
Made full, fit and outside Frame template automatically call zimplify()
You can control this with the new namespace parameter of zim.Frame()
So for instance once you make a new zim.Frame() inside, you no longer need the zim namespace
var circle = new Circle(rand(100,300), frame.green).center(stage); // will work
Note: there is no zim namespace before Circle - used to be new zim.Circle()
Note: do not call variables the same as zim functions:
var rand = rand(100); // as rand() will no longer work after this!
The zim namespace still works.
zimplify(exclude) has an exclude parameter that lets you pass in a string command or an array of string commands
and then these will require the zim namespace
zim.wiggle() now supports ZIM DUO configuration object parameter (Thanks Frank Los for prompting)
ZIM 5.4.0
Added zim.gesture() with pan, pinch and rotate multitouch gestures for position, scale and rotation
zim.gesture() features a bounding rect, min and max scales, rotational snapping and pan sliding.
IMPROVEMENT This is a new method under the Methods module for all ZIM Display objects
Also added associated zim.noGesture() and zim.gestureRect() Methods
for removing some or all of the gestures (and paradoxically, adding them back)
and dynamically setting the bounding rectangle for the gestures.
Works with the touch parameter set to true for zim.Frame() which is the default setting.
ZIM 5.3.2
Adjusted zim.decimals() so that addZeros is the number of 0 spaces after the decimal
addZeros is no longer a Boolean BREAKS
and a new parameter, addZerosBefore, is the number of 0 spaces before the decimal
Also added a time parameter that just turns the decimal dot into a colon to handle minutes and seconds
Added a total property to the ZIM intervalObject for the zim.interval() that is -1 for infinite
Added a "clear" transition type to Pages that fades out the old page then fades in the new page each at half the transition time
Added transitioning property to pages so can test if pages are in transition (as they are cached)
Adjusted docs - the radius of a zim.Circle is its real radius before scaling and setting the radius redraws the shape
as opposed to width and height which are not necessarily the bounds but can be a scaled value
Fixed multitouch with ZIM - was using: if (touch) createjs.Touch.enable(stage, true);
And yet unfortunately, the second parameter is true for singleTouch! Ouch.
IMPROVEMENT So now using: createjs.Touch.enable(stage);
Adjusted zim.drag() so that drag Ticker is not removed if any touches are still active
ZIM 5.3.1
Added simple array of pages to Pages class if you do not need swipe data for each page
Also, now use the default stage as the default for the holder of Pages and moved the holder parameter to the end
BREAKS - this breaks the parameter order of the Pages class
Since introducing the default stage, there are a few of these breaks.
Swapped zim.Ticker.has(function, stage) as stage will default to default stage BREAKS parameter order
BREAKS - moved the index to the second parameter of center and centerReg and the add to the last parameter
as more often than not, we are using centerReg and center to add the object to the stage and
the second most popular parameter is the level (index). Sorry, this breaks the parameter order for older apps
Added an optional index value for Pages go() so can use page object or an index matching the pages array order
ENHANCEMENT - added a check to zim.Ticker.add() so that it will not add the same function more than once
added blendMode property to all zim Display objects that is the same as compositeOperation
Fixed a glitch in Dial when min is greater than max - the ticks were not showing (used Math.abs() for tickNumber)
Adjusted ColorPicker to default to drag of false if there is no buttonBar.
ENHANCEMENT - fixed intermittent zim.interval() run-on after clear()
ENHANCEMENT - zim.Emitter() had a faulty assignment to "this" in the added function affecting dispose() on multiple emitters
Thanks Frank Los for reporting the bug
ZIM 5.3.0
Added ZIM SoundWave() to get frequencies from sounds or mic
Also adjusted the order of ZIM and the Documentation to the following:
WRAP - CODE - DISPLAY - METHODS - CONTROLS - FRAME - META
Display (formerly Build) has the basic display elements, shapes and components
Methods (formerly Create) have the methods that all display objects have like drag(), center(), etc.
Controls (formerly Pages) have objects for layout, swiping, pages, motion, parallax, etc.
Removed zim.addDisplayMembers() and fully replaced it with zimify() BREAK
ZIM 5.2.2
Adjusted interval doc description to include ZIM VEE and zik.
Added color parameter to Pane in the docs.
Adjusted glitch in Tabs when assigning widths to tabs without widths.
Added ZIM VEE and zik to control length of Blob so random blobs can be made
Added rotation, scaleX and scaleY read only properties to MotionController
and adjusted so no object is needed - now we can use MotionController as pure data
Adjusted zim.wiggle() to work on non display objects.
Added time property in the Docs for the zim.interval obj return value
ZIM 5.2.1
Adjusted zim.Emitter to properly set pool number when ZIM VEE values passed for num and interval
Now uses min of interval and max of num options - would recommend not pooling if using function values for either of these
Also fixed removing of particles if pooling is turned off
Adjusted the pause method of the zim.timeout return object - so unpausing plays the remaining time properly
Made zim.animate and zim.move apply zik before splitting scale into scaleX and scaleY so aspect ratio is kept
ZIM 5.2.0IMPROVEMENT Added StageGL support to ZIM Frame - as a gpu parameter which defaults to false - so set to true for WebGL
CreateJS provides an isWebGL property of the stage you can use to get whether WebGL is being used
Added gpuObject parameter to specify extra stageGL parameters
Added refresh to resize for StageGL
IMPROVEMENT Added nextFrame parameter to frame to pass interaction to next stage (for regular Stage and StageGL)
Added zim.convertColor() to convert from string to hex or hex to string (StageGL color accepts hex only)
Added spriteSheet parameter to zim.Sprite to accept a CreateJS spriteSheet
Prior to this the Sprite would make a SpriteSheet from JSON or image and parameters input
This was added because of the cool CreateJS SpriteSheetBuilder to dynamically create SpriteSheets from Shapes, etc. at run time
Fixed the clone property of Sprite
Adjusted Grid and Guide to auto add to obj parameter or the default stage - and fixed interval bug since zim.added() was used (thanks malus on GitHub)
Fixed bug in zim.Frame where two full mode canvases were turning off Ticker stage updates on the first canvas when resized
Fixed bug in zim.Frame was referencing keyword frame in key events when it should have been a reference to the object (that)
ZIM 5.1.0
Added a zim.Blob class to make editable blobs - with bezier curves
This is added after zim.Triangle and is very similar to the other zim shapes but a blob ;-)
Blob has a number of types of bezier curves that can be accessed by double clicking the points
Edits to the Blob can be recorded with the record() method and then recreated by passing the recording into points parameter
Created a global variable zimDefaultFrame for the first frame made
zim.Ticker.add(function, stage) and other Ticker functions no longer require stage
The zimDefaultFrame's stage will be used if left out of add()
This is fine for the majority of times when there is only one stage
BUT - if more frames are used then the associated stage needs to be passed to update that stage
IMPROVEMENT Added a failed event to frame for when canvas is not supported (thanks Frank Los for the prompting)
Added a type parameter to wiggle() so it can wiggle negative, positive or both (default)
Adjusted zim.interval to unpause immediately as an option
Made outline() mouseEnabled = false;
Made ticks a zim.Shape rather than a createJS.shape so it has ZIM 4TH methods
IMPROVEMENT Adjusted zim Emitter pause for the freeze - for some reason not reading stored that.zimEmitter... used local variable instead
Added frame.altKey, frame.ctrlKey, frame.metaKey, frame.shiftKey properties to specify key states
IMPROVEMENT Made Pane close and drag automatically resize TextArea and Loader objects (due to HTML overlay)
IMPROVEMENT Adjusted Loader to save as png by default or can specify type parameter of "jpeg" for jpeg (png more widely accepted)
ZIM VEE (5)
ZIM VEE AND ZIK
Introduced ZIM VEE (Roman Numeral 5) values that let you submit options for parameters to be chosen later (uses the new zik() function)
Added zik() global function to pick randomly from an Array or a function result or a random number based on
an object with min, max, integer, negative properties like the params for zim.rand()
ZIM EMITTER AND WIGGLE
Added zim.Emitter() to emit particles for fireworks, smoke, flames, falling objects, hair, grass, etc.
This is a large class with 30 parameters some of which accept ZIM VEE values
Examples can be found here: http://zimjs.com/code/particles
Added zim.wiggle() to randomly go back and forth between the value passed to it - uses zik() and animate()
ZIM ANIMATE AND MOVE
Adjusted zim.move and zim.animate to accept ZIM VEE values for many of the parameters
Including obj, set and props properties and overall parameters except for params, loopParams, waitParams, sequenceParams
These will then be filtered through zik() to pick a random values
This allows for a delay before a random value is picked - handy for passing info as a parameter
Used by zim.Emitter() for instance to pass random properties and animate settings
Added feature to zim.animate and zim.move to animate relative to current property value
To do this the parameter value in the animation object is put in a string - can include negative sign
Also works with the set parameter to set relative starting values
Fixed rewind with set parameter active - hopefully that works - gets complicated
zim.move() and zim.animate() - added waitedCall, loopWaitCall and rewindWaitCall to call functions after waiting and before loopWait and rewindWait
zim.move() and zim.animate() - added waitedParams, loopWaitParams and rewindWaitParams to pass params to above (or callbacks receive the target)
This BREAK parameter order - sorry! Hopefully by this time you are using ZIM DUO configuration object technique
Adjusted rewindCall and loopCall to happen after rewindWait and loopWait - so this may BREAK as it was before the waits!
Fixed a glitch in stopZimAnimate(ids) when removing animation with ids with single animations across multiple targets - now works
GENERAL ADJUSTMENTS
Fixed zim.Label used Number.isNaN which is not supported on mobile so changed to older double test. IMPROVEMENT
Fixed a bug in zim.copy - an undeclared var was flattening nested objects
Adjusted zim.copy to ignore objects that are not an object literal - now will copy references to zim objects rather than breaking
Adjusted zim.Triangle() adjust parameter to move shape rather than registration - could BREAK location of triangles
as usually you are adjusting the centerReg and that just was negating the adjustment
Added rotation to cloning of props - this was an oversight BREAK - but in a good way
adjusted clone for shapes to clone latest color and border properties
(and width and height for Rectangle and radius for Circle) possible BREAK
Added read only framerate property to docs for zim.Ticker - use setFPS() to set framerate
Added a has(stage, function) static method to zim.Ticker to check if the Ticker has that function for that stage
Fixed a glitch in zim.interval where it was occasionally not pausing due to race condition
Adjusted obj.clear to before the next() function in zim.timeout to prevent errors on occasion
Added an zim.added() function and ZIM 4TH method to check if object has been added to the stage
CreateJS has an "added" event that triggers when an object is added to another container
but this container may not be on the stage.
added polls with a setInterval every 100ms to see if the object has a stage property
Once it does then it calls the callback and removes the interval
Adjust scaleTo to take into account current scale - this could BREAK code if you had accommodated this already
Adjusted zim.rand() with respect to a=0, b=0 explicit parameters
was returning Math.random() now returns 0. Only no parameters return Math.random() - might BREAK
ZIM 4.9.2
Added zim.angle(x1, y1, x2, y2) function to find angle between two points relative to positive x axis
part of the code module after the zim.dist() function - these are functions not methods.
Added zim.placeReg(obj, id) function and zim 4th method to place locate a registration point relative to the obj
this then gives an output in the console as you drag and drop a little cross indicator (like place())
Adjusted zim.place() to output x and y and pos() data
IMPROVEMENT Adjusted the zim.Label to be up one pixel in the y on a button
IMPROVEMENT Fixed a bug in the Window where multiple windows would scroll together - missed a var declaration - oops (thanks Frank Los)
IMPROVEMENT Adjusted zim.Pages to remove its children at the start - except for the currentPage (thanks Laura Warr)
IMPROVEMENT Adjusted zim.Pages to not accept swipes or button clicks to go() until transition is finished (thanks Meagan Peat)
The ZIM Pages example http://zimjs.com/code/pages has been updated to modern zim code showing Pages, Layouts, Grids, Guides, and MVC
Fixed bug in frame.makeCircles - we had removed the frame module colors in favor of frame.blue, etc. and not adjusted makeCircles
ZIM 4.9.1
Added a resize() method to the Window to resize the dimensions without scaling the content
This allows independent scaling of the content to fit the width for instance in a long vertical scroll
Added a minSize property to the indicator property of the Window - already had the size property
For example:
indicator.size = 6; // the width if vertical or the height if horizontal
indicator.minSize = 12; // for the height if vertical or the width if horizontal
Added scrollwheel support to Window
Firefox has a canvas redraw glitch where it flashes unscaled/unpositioned content on full template resize
Implemented a fix where over 40ms the ticker.update is set to false and at 20ms the resize happens
It seems the requestAnimationFrame is catching the stage in a null dimension state or something...
Anyway - only on Firefox with full mode and a Ticker running - and fixed now. IMPROVEMENT
Adjusted Pad to default to an array of keys that match the rows and cols (of course!)
Adjusted Label to properly valign bottom and center when text is more than one line CHANGE
Also adjusted Label so bounds change when the text changes
ZIM 4.9.0
Added Loader class to upload files from desktop to canvas zim.Bitmap object and also save to new window
Added TextArea class to create an editable text box - it uses the HTML textarea tag and CreateJS DOMElement
Added outlineColor and outlineWidth to Label IMPROVEMENT
Added selectedIndex to ColorPicker docs
Adjusted a few bugs with arrows in vertical steppers - hopeful that is all fixed - quite complex
Made alpha change dispatch change event as well from ColorPicker IMPROVEMENT
Added return object of the animation target for a series
Fixed doubleclick glitch in zim animate created when a delay in protect was placed for animation series IMPROVEMENT
Added dashed parameter to Rectangle, Circle, Triangle, and Button
and made either borderColor or borderWidth create a border and make the other parameter have a default
and made shapes be transparent if no color is specified AND a border is specified BREAK
otherwise passing null for the color will default to black (as it has all along)
This was a pain when you wanted a border without a fill - you had to set the fill to "rgba(0,0,0,0)"
Fixed Label clone when there is a backing - must clone the backing too ;-)
Rearranged vertical Slider to have min at bottom and max at top BREAK
ZIM 4.8.2
Added tab control in frame with tab highlight, highlight object and a number of parameters IMPROVEMENT
This is demonstrated in the LeaderBoard of http://zimjs.com/code/zong
Will be expanding tab control - currently steppers and tabs - although any display object
can be added manually to the tabOrder. So now tabbed to objects can receive an Indicator
Looking into screen reader support as well - although many things made in ZIM are visual.
Updated zim.fit() to take into account bound x and y when fitting.
ZIM Game 1.0.1
LeaderBoard has integrated key and gamePad controls for entering name IMPROVEMENT
An editing page has been set up to update five security options IMPROVEMENT
Automatic bad word filter has been added to the ZIM data mode IMPROVEMENT
ZIM 4.8.1
Stepper updates - added press, rightForward, downForward parameters to Stepper BREAK
changed arrows to represent visual arrows - so set to false to hide them
added arrowKeys parameter to use or not use arrow keys - default true
changed default vertical forward direction to down unless numbers and then it is up
can change these with rightForward and downForward parameters
made it so mousedown immediately advances stepper (unless press is false) IMPROVEMENT
this was an oversight - got missed when implementing hold parameters
or perhaps we did not want it to advance immediately if users are wanting to hold drag backwards...
Adjusted Label to accommodate backing in its bounds calculations - assumes if backing the bounds are that of the backing
Removed the default ZIM Wonder server parameter value as it runs the risk of being out of date IMPROVEMENT
Implemented a zimserver_url.js file that will always hold up-to-date domain:port urls for ZIM Socket, ZIM Wonder, ZIM Distill
In doing so swapped the server and notes parameters so this BREAKS previous signature - as server is required and notes is optional
ZIM 4.8.0
Added zim.GamePad() to handle game controller input for buttons and sticks IMPROVEMENT
Added zim.MotionController() to handle moving a target object with the following types: IMPROVEMENT
mousedown, mousemove, keydown, gamebutton, gamestick, swipe, manual
includes adjustable speed, damping, flipping or rotation, key/button mapping, firstPerson mode, etc.
Damp and ProportionDamp now return the object for chaining
ZIM 4.7.3
Changed zim.Ticker to use requestAnimationFrame with default no throttle IMPROVEMENT
Added setTimingMode() static method to Ticker to go back to synched or timeout modes
setFPS(mobile, desktop) is still available but can lead to less than smooth performance
(NOTE: the initial launch of 4.7.3 was not quite right so we patched it a few days after)
added zim.sign(num) to return -1, 0, 1
added zim.constrain(num, min, max, negative) to constrain number to within and including bounds
added zim.dist(x1, y1, x2, y2) to calculate the distance between two points
Adjusted Frame to stage.update() on full mode resize IMPROVEMENT
After canvas adjustment a few updates ago this was causing flicker
or things disappearing until next stage.update()
The stage will not update in full mode on resize if zim.OPTIMIZE is set to true
You will have to manually update the stage in your resize event function to see anything on the stage
Adjusted zim.Pane to not do anything to the text when you change it
If you want the text to be centered always, then start off with a zim.Label with align:center
ZIM 4.7.2
frame.loadAssets() now returns a zim.Queue object where we can capture events for a specific loading
Also there is an isLoading property on the Queue and reference to the createjs.LoadQueue with a preload property
The frame also captures these events for all queues as before and now has an overall isLoading property.
Thanks to Frank Los for prompting the changes and helping with the solution.
loadAssets() has a new time parameter to force the preload to wait at least this long in ms.
This can be used in testing and for when you want a minimum time to show a preload message
Added a showing property to zim.Waiter() and zim.Pane()
You can now loop an animation inside an animation series forever - it just will not proceed to the next animation
The set parameter for zim.move() and zim.animate() now lets you set scale (the convenience property for scaleX and scaleY)
Went back two updates to fix the loopCall parameter which was not calling when looping forever
since the change to the loopCall to not call on the last loop - use call for that (nice sentence!)
Added a zim.Dynamo() class to handle dynamic Sprite animation
You pass the Dynamo a Sprite, a base frames per second an optional label or start end frames
The Dynamo should be able to parse any type of CreateJS spritesheet data including nested animation labels
It turns these into an array of frames animates through the frames with percentSpeed available to adjust dynamically
The Dynamo also allows you to pause with a time delay or a on a frame number - and of course, unpause
Added a zim.Accelerator() class to handle dynamically changing speed and pausing of Dynamo and Scroller objects
This allows you to control the objects from one place to dynamically change the speed of a scene
Upddated the Scroller class to allow for pausing and percentSpeed
And the Scroller no longer has to be added to the stage to work
and in either case, the scroller backgrounds do not have to be on the stage to make a Scroller
See http://zimjs.com/code/zide/ for an example
ZIM 4.7.1
Added zim.interval(time, call, total, immediate), zim.timeout(time, call) that use requestAnimationFrame
Added zim.siz(width, height, only) for chainable size method
with either width or height, will scale the other to keep proportion unless only is set to true
Removed Dashed Lines - as CreateJS now does a dashed stroke. (BREAK)
Fixed Frame in full mode to resize canvas dimensions rather than create large canvas (IMPROVEMENT)
due to unexpected repositioning in apple devices (of course).
For instance, how can a canvas with no left and top be moved hundreds of pixels off the screen to the left
when switching orientations? Even when left and top are set to 0px; Get your act together Apple!
Problem is... it is a problem for ages.
Added a delay parameter to frame to make mobile devices redo a resize event to catch proper dimensions - default 500ms
made Pane and Waiter show() and toggle() chainable
adjusted zim.rand() to convert parameters that are NaN to 0
Adjusted zim.animate() and sprite.run() to let inner animation series loop forever
this will make the looping forever series the last animation to run in the series
added frame.clear (alpha 0), frame.white, frame.black, frame.faint to colors - faint is alpha .01 good for invisible interactivity
ZIM 4.7.0
major update to zim.animate() to run animation series
also better id control for pauseZimAnimate() and stopZimAnimate() IMPROVEMENT
now documented as proper methods and with optional global control on zim directly.
removed zimTween from move() and animate() and added reference to zimTweens (BREAK)
removed stopZimMove and pauseZimMove - use stopZimAnimate and pauseZimAnimate for all (BREAK)
adjusted loopCall to not run after the last loop - that is when call runs (BREAK)
changed rewind props to be set after initial wait
added set parameter to move() and animate() to set properties at start of animation
updated docs for move() and animate()
Sprite.run() uses new animation series and stopRun() and pauseRun() use animation id system.
Sprite has json parameter which replaces spriteSheet parameter BREAK
The SpriteSheet is now made internally from the json
can still pass in rows and cols as well instead of json
added makeID() method to code module
frame now gives the stage read only stage.width and stage.height properties
added single param (default false) to zim Dictionary
added reg() and sca() methods for consistent shortcuts to regX, regY, scaleX and scaleY
ZIM 4.6.0
added addTo() and removeFrom() functions / ZIM 4TH methods
these are wrappers for addChild() / addChildAt() and removeChild()
except they are consistent with center() and centerReg() where the obj comes first and the container is in the brackets
circle.addTo(stage); // rather than stage.addChild(circle);
circle.center(stage);
circle.centerReg(stage);
circle.removeChild(stage);
This also allows us to chain objects easier
var circle = new zim.Circle().addTo(stage);
var circle = new zim.Circle().addTo(stage).drag();
Added pos(x, y), mov(x, y), alp(alpha), rot(rotation), ske(skewX, skewY) functions / ZIM 4TH methods
chainable functions for common properties (a little shorter than set() method)
Note: pronounce mov() as "mawv" to differentiate from move()
mov() sets relative position in x and y - like circle.x += 100;
var circle = new zim.Circle().center(stage).mov(100); // shifts shifts to right 100
Added zim Swiper() class to Pages module to act like invisible slider with damping
Overhauled zim Sprite() to include the SpriteSheet and data creation
also added a run() method to animate the Sprite over time (see advanced ZIM Capture)
This gives two line Sprite animation with better control (BREAKS signature)
It still works with a CreateJS SpriteSheet if desired.
And optionally, you can pass in the JSON for the spritesheet.
Added keydown and keyup events to frame - wrappers for window events
Pages now dispatches a pagetransitioned event - not pageTransitioned (BREAKS)
removed secondary reference to colors in frame (BREAKS)
added frame.gray (already have frame.grey - these two are the same)
arrow keys for stepper now move secondary steps if in cross direction
also made stepper secondary arrows only show up for type of number
adjusted loop() to pass index, total, min, max, obj consistently as final params to call (BREAKS)
also added internal bounds to loop to handle out of bound step, start and end values
adjusted loop documentation to be more clear - should be the end of loop adjustments
corrected the zim Swipe docs to not include container properties
corrected frame variable (should have been this) to fix bug in strict mode
adjusted scaleTo() to scale to 100% in x and y when both are null - still default "fit"
so just using rect.scaleTo(stage) would fit the rect on the stage
previously, passing in no percentages would not scale at all.
adjusted typo in parallax Docs - scrolly should have been scrollY
rand() now has negative parameter to let you choose from a positive or negative range
ZIM Frame loadAssets() has been adjusted to include extra file types:
JSON, Text, XML, and SVG data can be loaded (as per CreateJS PreloadJS info)
ZIM 4.5.0
added a from parameter to zim.move and animate
you can set the from parameter to true to animate to current values from properties provided in obj
sequence in move and animate now works on a container as well as an array
added sequenceReverse parameter (BREAKS parameter order!!!) to handle sequencing through children (or elements) backwards
added a zim.ANIMATE global constant to prevent move and animate from running (eg. while testing)
added a check to move and animate for targets not on stage - to avoid the obtuse Ticker error message
IMPROVEMENT: updated Stepper with a bunch of new parameters:
hold, holdDelay, holdSpeed, drag, dragSensitivity, dragRange, type,
min, max, step, step2, arrows2, arrows2Scale, keyEnabled
also set keys work on Stepper only if they have focus or are first made
added focus property to Stepper
changed the strokeColor to borderColor - BREAKS old code... (sorry - now we consistently use border rather than stroke)
adjusted stepper to not return when setting currentIndex and index is same as currentIndex (might have changed the stepperArray)
also made setting the stepperArray update the currentIndex which will refresh the view
adjusted slider, dial, stepper currentValue to return if value set to undefined
zim.decimals(num, decimals, addZeros) will add zeros to decimal place if missing - for presentation
IMPROVEMENT: set drag to work if mouse is outside stage - on now by default - should have been on (oversight)
added a fadeTime parameter to Waiter and Pane to fade in and out for the provided milliseconds
added step, start and end parameters to zim.Loop took away total parameter (BREAKS)
added ZIM DUO to loop now that parameters are longer...
gave Circle a radius property get / set - that redraws the circle (not scales it like width and height)
Circle, Rectangle, Triangle parameter change - BREAKS zim DUO for the following:
color (not fill), borderColor (not stroke) and borderWidth (not strokeSize)
also the methods setFill(), setStroke() and setStrokeColor have been removed (BREAKS)
added borderColor and borderWidth properties - already have a color property
changed the borderThickness properties in Button and Window to borderWidth to match (and match css) - BREAKS zim DUO for these
added width, height, fullscreen parameters to zgo and shifted modal parameter to end (BREAKS)
made rand() set integer to false if a or b are not integers
added backing color to ColorPicker
fixed little glitch in animate() ticker paramater
Reordered EXAMPLES so ZIM 4TH versions come before the traditional zim functions
ZIM 4.4.0IMPROVEMENT: hitTests improved by having mathematical hitTestBounds as filter
made it so can't add gradient or gloss if custom backing
fixed hitArea on indicator when square type is chosen
fixed indicator to update selectedIndex before dispatching change events
added swipe to window doc
made zim.loop() the name for all zim loops again and adjusted docs (BREAKS)
ZIM 4.3.1
Added read/write width, height, widthOnly, heightOnly properties to all zim displayObjects
Could BREAK old code where width and height were read directly from getBounds().width and getBounds().height
now they are getBounds().width*scaleX and getBounds().height*scaleY so they match the set width and height.
This is a fairly big change - now when you can set the width and this will adjust the scale to make the shape match the width inside the parent bounds
If you want to get the width of the bounds without scale - then use getBounds().width
It also means that the scale will probably be changed when you set width and height.
Hopefully this will not cause too many problems. We went through the 64 ZIM Bits and adjusted a couple places
In one case we had to go back to the getBounds() but in another case it helped the app be more intuitive and we removed a tricky scale call
Added prop(property, value) method to zet to get or set the a property (or properties) of the set.
Adjusted docs to more explicitly list CreateJS methods, properties and events for each Build Module class
Made RadioButtons have a default of A, B, C
Fixed zim.drag surround to handle bounds with x and y not equal to 0 (like for a circle)
Fixed rotated container origin marking for zim.outline
Removed bound requirement from center. Removed container bound requirement from centerReg
ZIM 4.3.0
introduced zim.extend(sub, super, override, prefix, prototype) which piggybacks on createjs.extend and createjs.promote
now all extends are done using this so that ZIM classes can be properly extended
this means that the createjs namespace must be loaded before ZIM - too bad, but that's okay
So if you load ZIM before CreateJS this BREAKS and gives a ZIM message followed by an error - most likely Frame is not a function
Just put the createjs script call above the zimjs script call.
all classes are now one function - had to add the scope parameter (this) to zob() for these.
IMPROVEMENT: fixed memory leak in Button - was not clearing mouseout event - off() sometimes does not work!
updated RadioButtons dot to default .7 alpha in color
fixed sequence to take into account the new loopCall and loopParams
had to adjust loop() so that a return is used to continue and a return with a value is used to break
return "continue" no longer continues it actually breaks - the function is only one version old so may as well fix it
moved loop() to code module and made loopChildren() in Create module for containers - may adjust this later
this BREAKS if you were using loop() on container
updated the Button description and added pizzazz to icon param description
IMPROVEMENT: added a rollPerSecond parameter to zim.Frame with a default of 20 checks per second (was set at 10)
ZIM 4.2.1
added a setBackings(newBacking, newRollBacking) to match the setIcons() in Buttons
also made toggle work for backings if there is no icon set and it is not a string (to toggle label)
adjusted the docs to wrap the signature of the function when you open a section
fixed clone of button to make sure all new paramters get cloned
adjusted hitArea of label to not be stored as the backing when no backing
as it caused clone problems - the clone then thought a backing was set when it was just the hitArea
ZIM 4.2.0
added icon and rollIcon parameters to button to accept display object like pizzazz2 icons
added setIcons(newIcon, newRollIcon) method to button to allow dynamically changing the icons
added toggle and rollToggle parameters to button to handle toggling the label or icons
added toggled property to button that returns true if in toggled stage and false if in original state
added toggle() method to button to force a toggle (or set state to true or false)
added 2px to height of text in labels to accommodate descenders
added loop() function to Create Module to loop or loop through children of container
tested with 1000 children and no speed difference
added isEmpty() function to test if object literal is empty
added loopCall and loopParams parameters to move() and animate()
and adjusted call to call after all loops and rewinds have finished
(always thought this was what it was doing but realized NOT)
this change BREAKS the signature - sorry - but hopefully you are using ZIM DUO config for this
added protect parameter to move and animate to ensure animation finishes
cancels any subsequent animation calls
added override parameter to move and animate to allow multiple animations on an object
without having to set props:{override:true} - does the same thing
updated ZIM 4TH version of move and animate to full parameter set
removed pauseZimMove, stopZimMove, pauseZimAnimate, stopZimAnimate when tween is done
added color property to stage to get or set background color (there already is a color parameter)
fixed dial setting currentValue if max is less than min
added read-only angles property [left, bottom right, top right] to Triangle
IMPROVEMENT:adjusted zim.Dial to record last angle when clicked to avoid wrapping when not supposed to
ZIM 4.1.3
added stage.update to colorPicker when indicator present (follows zim.OPTIMIZE)
made indicator #111 when color is #000
added copyMatrix function to Create Module and use it in move, animate, setMask, drag and clone
made move and animate work with setMask to animate the mask (like drag drags the mask)
ZIM 4.1.2
ColorPicker has circles property added for circle swatches
ColorPicker has buttonBar property added to be able to set to false and hide buttons
added indicator parameter defaulting to true that shows currentColor
added selectedIndex property to ColorPicker
recorded lastColor and lastAlpha when setting selectedColor, selectedIndex and selectedAlpha
added id parameter to place method
IMPROVEMENT: fixed Button to center custom label after label bound changes in 4.1.1
added specific clone methods to Rectangle, Circle and Triangle
added rollPersist parameter and property to Button to keep rollColor when button being pressed even if rolled off
made slider use rollPersist=true
added gapFix back to scroller - still getting very thin gap if changing speeds - gapFix:1 should do it - default 0
adjusted move and animate to not run another animation for properties that are currently looping or rewinding
when these are done or the tween removed with stopZimMove or stopZimAnimate then animating these properties is okay again
problem was the tweens if overwritten would start from their last stopping spot
ZIM 4.1.1
added backing to Label
added position:absolute to Frame (fit, full, outside) so no styles required up top now
removed depreciated stageW and stageH properties from Frame (use width and height) (BREAKS)
fixed up bounds of label (I hope) and adjusted button placement
added fontOptions to Label clone
this could affect making a custom cursor out of a label - now need to set the mouseEnabled of label false
ZIM 4.1.0
Added backing and rollBacking support to zim.Button and zim.Pane (not rollBacking)
IMPROVEMENT: Fixed hitArea on zim.Label when centered
changed Pane move cursor to pointer
changed Pane backing property to backDrop to avoid confusion with new backing parameter
added toggle() method to Pane
added pointer cursor to Pane display when displayClose is true
ZIM 4.0.1
Updated docs to have proper sentences for description.
Adjusted zim.Triangle() to make isosceles have a unique base number
(makes triangle symmetrical about the Y axis). This causes different behaviour.
Fixed glitch in dragRect() for when no previous rect specified and localBounds set to true
Refactored zim.Window - added paddingVertical and paddingHorizontal
and indicatorDrag - which BREAKS the signature - sorry.
ZIM 4TH - 4.0
added zim Container, Shape, Sprite, MovieClip display wrappers
these extend are made from CreateJS counterparts
but they all have the ZIM Create functions added as methods
and they also have read only width and height properties based on getBounds
all ZIM display objects now extend a zim.Container
fixed zim.Drag glitch with removing zimDragTicker
fixed label to center properly when text is updated
adjusted documentation on width and height of button read only
added reference to AbstractContainer methods in all display object docs
added reference to createjs docs in docs
added RETURN values in documentation for every function
added EXAMPLE for every command in the documentation
added PARAMETERS for every function in ZIM Create module (already in other modules)
added global function isDUO to test if parameters are in config object format
added clone to all objects including cloned basic properties
and recursive cloning for Container and Window
moved Parallax and Scroller to the end of the PAGES module
this gives clean break with all display, shapes and components in BUILD
Renamed ZIM DISTILL to ZIM META
and added zim.Wonder to META
added a check to see if objects are on stage for all hitTests
added zil to fit and outside scale modes too
added fontOptions to zim.Label - for ordered font-style font-variant font-weight
did not realize that these can't be put after the font-size... sigh
adjusted gloss and gradient to not go over the border of the buttons
added startBounds (true) to drag() set to false to ignore bounds on start
inserted color parameter into Frame after height - will BREAKS legacy code
added css parameter to animate - set to true to animate html tags with css
added PARAMETERS section to all documentation
made section titles different color in docs
made example for each and have that be boxed
added props to normal parameters for animate and move
ZIM 3.1.4
Removed fps from animate and move - signature change at end!
Handle fps via zim.Ticker
adjust Frame to recognize tag scaling inside DOMContentLoaded
added one, two and three properties giving points for corners of Triangle
adjusted cloneAsset() method of Frame to clone id
ZIM 3.1.3
Fixed Ticker default fps
ZIM 3.1.2
added id to asset property on assetloaded event object
added getStage method to sound instance of asset so can animate volume and pan
added stopZimAnimate, stopZimMove, pauseZimAnimate and pauseZimMove
for the target of animate and move functions
tab to flatbottom default
added scrollXMax and scrollYMax to window
added index to center and centerReg that works like addChildAt()
ZIM 3.1.1
added Window class to Build module
added slideSnap of vertical and horizontal in drag create module
added slidestop event to documentation for drag
added lineWidth and lineHeight properties to zim.Label
added cloneAsset() to zim Frame for copying images and keeping width and height props
ZIM 3.0.4
adjusted zim.Button to center the logo
todo - make hitTestRect and hitTestCircle have an offset parameter
todo - change tabs and grids to use hitTestGrid for rollovers and hits
add a backing color and padding parameters to label
ZIM 3.0.3
added zim.mask() to work with ZIM Rectangle, Circle and Triangle
adjusted zim.Frame to default to tagID + "Canvas" for canvas ID
no changes to zim.Frame if on any other scaling mode
ZIM 3.0.2
rotated zim.outline()
fixed bug in ZIM Dial so it properly takes into account custom start position in dragging calculations
adjusted buttons to have centered labels
ZIM 3.0.1
added valign to Label params
valign - defaults to "top". Options: "top", "middle / center", "bottom"
fixed DUO for center() (was pointing at centerReg)
fixed center() bug with rotated and scaled containers
adjusted outline() to show rotated origin
ZIM TRI - 3.0
added align and valign to frame
changed ZIM Frame to work on DOMContentLoaded and for delayed canvases, on document.readyState=="interactive" or "complete"
also made resize event trigger for all scale modes not just full
added sound parameters to asset().play(params) for {loop:-1, volume:.5}, etc.
drag default dragging cursor is pointer rather than resize
added swapHTML to swap innerHTML of two tag references
added zet(selector) function with on(), css() methods to apply events and properties to selectors
added a tag option for ZIM Frame scaling parameter to put Frame into an HTML tag
like a full setting with no scaling but in the dimensions set by the tag
added a scale property (read only) to ZIM Frame (will be 1 for full and none)
added an x and y property to frame position added by Frame (0 and 0 for full and none)
added a canvasID parameter to ZIM Frame to handle multiple canvases on one page
added a readyState check to ZIM Frame in case loading it after the window load event has triggered.
added add parameter to centerReg in DUO modes
added a zim.center() function that works like centerReg with a container but does not center the registration point
adjusted centerReg() and center() to move to center relative to container even if not adding to container
adjusted centerReg() to test for bounds on container
added multiple stage support for ZIM Ticker
adjusted ZIM move and animate to wait 200ms before removing Ticker function to let animation finish
added objects and values properties to ZIM Dictionary for easy traversal
added rotation support to zim.Outline
adjusted hitTestCircle() and hitTestRect() to check for a point in the middle too
made zim.Drag() automatically remove the tweens from dragged object
and then set a parameter called removeTweens which defaults to true
made ZIM drag add to Ticker queue only on mousedown and off on pressup
added displayClose parameter to zim Pane() to default to true
if display backing is pressed it closes unless drag set to true of displayClose set to false
set Pane's Label to mouseEnabled = false;
this is different behavior to original Pane settings where display press would not close Pane
ZIM 2.6.1
BUG FIXES
CREATE
fixed bug in zim.Ticker - was not storing stage when always was used alone
BUILD
added rounding to non-divisible steps in Slider
added inside parameter to Slider documentation
FRAME
added frame.tin for the #777777 color missing between silver and grey
added frame.purple for dark accent color
frame.lighter color needed an extra e.
ZIM 2.6.1 Updates - centerReg, labelColor, checks, makeCircles, etc.
CREATE:
added an add parameter (default true) to zim.centerReg()
which automatically adds object to the container if container is provided
so zim.centerReg(rect, stage); will center the rect on the stage and addChild to the stage
a touch of a risk as it may be better to always let people addChild - but I do this so often
that I thought I might bend a little. You can pass false as a third param to avoid the addChild
BUILD:
added labelColor to Tabs and Pad classes (BREAKS signature near end - sorry) BUILD
updated Pad documentation
adapted Stepper label to use new centered Label text
added optional type of checkbox for x and square checks
RadioButton, CheckBox, Stepper no longer dispatch change events when set with properties like selectedIndex
so only dispatches change on user input - this changes the behaviour of older zim
FRAME:
has a 250 and 500 ms refresh added to resize events due to mobile delay in changing dimensions
added zon error message to missing sound assets so play() will not break app
added zim.makeCircles() function which ZIM circles for logo
ZIM 2.6
CREATE
Added id to zim.place()
BUILD
Added Pad component
Added Dial component
Added inside parameter to Slider to fit button inside bar
Added press on bar to move slider to position
Adjusted Tabs to alternately take an array of numbers or strings as tabs parameter
Changed Tabs font size to half height
Changed Tabs auto to currentEnabled (just the click on current tab is not enabled)
must now set color and selectedColor to same to be like button
Fixed Tabs dispose
Fixed Button dispose
Fixed 0 glitch in Label "" == 0 what do you know!
FRAME
added ZIM colors as properties
edit all links to https:for cdn
-> need to add pause property to scroller
ZIM 2.5
MOVE & ANIMATE
added support for moving and animating an array of objects
including a sequence parameter to set time delay of animations on array
this makes marquees, etc.
this means that zim.copy() has to be copied into the stand alone CREATE module
added loopDelay property to move and animate props parameter
this adds a delay after the animation happens (and before a looped animation)
DRAG
Added surround, slide, slideDamp, slideSnap and reg params to Drag in CREATE
added dragRect() to dynamically set the drag rect in Create
TICKER
added Ticker class to Create module - and any that use Tickers
need to add Ticker class to stand-alone BUILD module
removed ticker parameter from any zim functions
made zim.move and zim.animate use the zim Ticker
made zim.drag use the zim Ticker
made zim.Parallax and zim.Scroller use the zim Ticker
MISC
added Dictionary class to CODE module
adjusted zim.mobile() to return "android", "Apple", "blackberry", "windows", "other" or false
Scroller added startPos and endPos params in BUILD
Fixed globalToLocal issues in Scroller
added place() method to CREATE to position things and get location in console
Added text property set and get to CheckBox in BUILD
Added display parameter to stepper to show or hide the text display
Fixed small bug in stepper in setting currentValue and currentIndex
added tripple screen support to max canvas size (which also fixes android sizing bug) in FRAME
added registration support to zim.fit() - might change your code!
added a display parameter to zim Stepper to show (default) or hide the display
switched the arrow direction on vertical Stepper too - sorry up arrow activates arrow on top (BREAKS)
added align parameter to text for left (default), center and right
fixed alignment formula for Pane
fixed target in zgo() for WRAP - was always opening in _blank
return v==null; used for zot(); in WRAP
Fixed Proportion to work with larger number first
consider default container.addChild(obj) for zim.centerReg(obj, container)
ZIM 2.4
ColorPicker component
gave slider a width and height property
fixed Waiter default shadowColor to #000 with alpha
ZIM 2.3
CREATE
Added a hitTestGrid function
Added a paddingVertical to expand so can optionally provide different padding in horizontal and vertical
BUILD
added zim.OPTIMIZE and zim.ACTIONEVENT constants
OPTIMIZE defaults to false but if set to true, components will not stage.update for any presses or property sets (only for mouseover/out)
ACTIONEVENT defaults to "mousedown" and if set to something else then changes to click - can toggle this with zim.mobile() if desired
Added Tab component
added color and rollColor properties to set dynamically on button
fixed enabled bug on button (set mouseChildren false after re-enabling)
added color of label and roll dynamically
PAGES
exposed the regions object of the Layout class for dynamic alteration to Layouts - must call resize() after changing.
made HotSpots and HotSpot follow zim.ACTIONEVENT
Pages documentation should have read lastPages not oldPages
FRAME
made zim.Frame set default rollover to !zim.mobile() (a quick test for mobile)
ZIM 2.2
added fps and ticker properties to move and animate to create module
added fps and ticker properties to parallax and scroller in build module
added mobile function to code module
updated parallax module with fps and ticker
ZIM 2.1
Added always parameter to RadioButton
Fixed margin on Checkbox
Made checked always black but can set color with check.color
Made RadioButton selectedIndex property call a change event if set
Made CheckBox selected property call a change event if set
Made Stepper currentIndex property call a change event if set
Added enabled property to button, checkbox, radio, slider, stepper
ZIM DUO - 2.0
We now minify all the modules and the full zim code under just the zim and version number, i.e. zim_2.0.js.
So no more _min. The only file that is human readable has _doc after the version number, i.e. zim_2.0_doc.js.
Added zob() which allows us to provide a single configuration object for many of the zim functions
CREATE
animation loop fix
added count
added target return in call with no params
added scale convenience to animate
flipped the ease if doing rewind for move and animate
added expand() function to zim create module
BUILD
fixed Pane shadow to alpha
fixed bug in resets and documented as default true
pane center parameter now documented and adjusted to remove all centering if set to false
fixed Label with 0 value bug
fixed Stepper arrow loop bug
added Stepper to press on box
changed default Stepper to go from 0-9
Waiter does not dispatch a close event
made Slider class
fixed initial RadioButtons id bug