danzen / zimjs

ZIM JavaScript Canvas Framework - Code Creativity! Interactive Media For All.
Other
507 stars 47 forks source link

I had the unfortunate displeasure of trying to use a Texture Active. #55

Closed Dimcon closed 3 months ago

Dimcon commented 5 months ago

I appreciate what this library attempts to achieve, but I can't consider it usable or recommendable for the many ways that it seems to break good programming practices. Such as:

The one feature that made me look at the library, Texture actives.. I could not get to work. Seemed like an unmaintained feature (The constructor for a TextureActives object expects a list containing just one texture active?)

Great idea! But unfortunately the implementation has me looking elsewhere.

danzen commented 3 months ago

ZIM is a Framework. So globals can be quite handy for us. If you want to turn them off then use the NPM version or if using the CDN then set zns=true for requiring the ZIM namespace and avoiding adding ZIM classes to globals.

We mostly work with a single frame. This lets us assume this frame's stage as the default container. If there are other frames then their stage would need to be specified unless one decides to use setDefault() on that frame. This is a convenience and would not really call it a state but maybe.

We do have some three letter global functions that start with z - for ZIM. They are short such as zog(), a wrapper for console.log(). If we put a namespace in front of them like zim.log() then that is about the same as using console.log() making the wrapper less appealing. I would not call that bad naming, but rather clever naming to avoid conflict for short globals and to have some fun.

TextureActives() accepts a single TextureActive object or an array of TextureActive objects as it states in the docs https://zimjs.com/docs.html#TextureActives so this is not an unmaintained feature.

Sorry we got to this post late - hopefully you found your way into our Forum https://forum.zimjs.com or Discord https://zimjs.com/discord support - we would be happy to help you get it working. Since this time, we have added 35 examples found here https://zimjs.com/studio - that will perhaps help.

If you do make your way back here... we apologize for your unfortunate displeasure ;-). Join our forum, discuss globals, and let's make it better!

danzen commented 3 months ago

Here are the ZIM globals - so nothing else is global if zns=true is set to require the zim namespace:

WW (JavaScript window - saves 1.5K as window reference is not minified)
createjs (namespace)
zim (namespace)
zns (zim name space - set to true before importing ZIM to require namespace)
zon (set to false before importing ZIM to stop all console messages)
zimBlob (used to avoid import conflict with JS Blob)
zimWindow (used to avoid import conflict with JS Window)
z_i (global iterator - reused rather than declaring i all the time)
z_d (function for ZIM Distill - like tree-shaking)
isDUO (used for ZIM DUO technique)
zimify (turn ZIM functions into methods as of in ZIM 4TH)
zimplify (function that adds all ZIM Objects to the global namespace)
zimDefaultFrame (an original global reference to the default frame)
zdf (the shortened reference to the default frame)
F, S, W, H, M (frame, stage, stageW, stageH, mobile)
ZIM WRAP module of short globals starting with z
zog, zid, zss, zgo, zum, zot, zop, zil, zet, zob, zik, zta, zor
zog has zogr, zogb, zogg, etc, for various colors
ZIM CONSTANTS:
FIT, FILL, FULL, LEFT, RIGHT, CENTER, MIDDLE, START, END, TOP, BOTTOM, OVER, UNDER, HORIZONTAL, VERTICAL, BOTH, RANDOM, RADIAL, UP, DOWN, NEXT, PREV, AUTO, DEFAULT, ALL, NONE, AVE, GET, POST, LOCALSTORAGE, SOCKET, TO, FROM, BOTH, SINE, SQUARE, TRIANGLE, SAW, ZAP
ZIM Colors:
red, orange, yellow, green, blue, purple, pink, brown, interstellar, black, darker, licorice, dark, charcoal, grey, gray, granite, tin, pewter, silver, fog, mist, light, moon, lighter, white, faint, clear