adolfintel / warpspeed

Animated and tweakable starfield for HTML5 Canvas
107 stars 22 forks source link

Dynamic parameter changes? #7

Open ogrotten opened 2 years ago

ogrotten commented 2 years ago

I've created WarpSpeed.prototype.update() method that takes in a complete config object (your copied config) and remaps it to this.VARS just like your prototype constructor.

I have moved the config to the index, and am allowing the user to dynamically change the config parameters by sending to the update method.

I have logs inside of draw() that show that the value has changed, but it doesn't redraw with the new parameters. IOW, if I change STAR_SCALE, the variable changes, but the screen does not.

Right now I'm just sending the config via update, but I've even tried to destroy and recreate the original.

Would you be so kind as to take a look at my source and see what I'm missing?

https://github.com/ogrotten/wallpapers/tree/warpspeed/star_drive (index and starry.js)

ogrotten commented 2 years ago

Well it seems I figured it out like minutes after posting.