Hi Dan,
I ran into a bug with Emitter that only appears in a newer ZIM/CreateJS version. The exact same activity code works fine in my older version but breaks in the newer one.
Error (from mobile Chrome remote debugging):
Uncaught TypeError: Cannot set properties of undefined (setting 'snapToPixelEnabled')
at t.Emitter.spurt (zim.js)
at my sekiller.js (the .spurt(20) call)
How I create the emitter:
js
var emitter = new Emitter({
obj: new Poly({min:30, max:50}, [5,6,7], {min:.5, max:.7},
["#E74C3C","#3498DB","#F9E79F","#A04000","#F7DC6F","#82E0AA"]),
force: 2,
gravity: -8.5,
startPaused: true,
cache: true // this is what triggers it
});
emitter.loc({target:{x:..., y:...}, container:stage}).spurt(20);
What happens: When cache is true, calling .spurt() throws the error above and no particles appear. It looks like an internal object is undefined at the point where snapToPixelEnabled is being set, so the cache/bitmap path fails.
Key detail — it's version-dependent:
- Older ZIM + CreateJS (my 2nd-grade project): same code works, particles appear.
- Newer ZIM + CreateJS (my 3rd-grade project): same code throws the error.
So this looks like a regression between the two versions.
Workaround I found: Setting cache: false makes it work again, which confirms the problem is in the cache path.
I originally used cache: mobile() for performance on phones, so I'd love to keep caching working. Could you check whether spurt() handles the cached-object case correctly in the newer build?
I can send the exact version numbers (zim.VERSION and the CreateJS version) for both projects if that helps.
Thanks!
