javaScript example tax brackets

So for todays javaScript examples post I thought I would throw together a quick module that can be use to get the basic idea of a progressive tax system up and running. This is one thing that comes to mind when creating a collection of javaScript examples, and it is also something that I would like to have a basic general understanding of anyway.

the aim here is to not make something that would be used to seriously work out ones taxes. The aim is to work out a simple bracket system that might coincide with a real life system or not. In any case do not use what I work out here to do your taxes, but if you want to find a starting point when it comes to gaining an understanding as to how a progressive tax system works maybe this is a good starting point, but I would look for additional resources of course.

Read More

Canvas input keyboard events and input in general

When working out a javaScript project canvas keyboard events might sometimes need to be used with mouse and touch events when working out a user interface. Of course these days touch and mouse events should always be used first and foremost when working out an interface, however keyboard support would still be a nice addition for some projects. There are certain types of games that just translate better as a so called desktop application, with these kinds of projects I still make sure that I can be used on a mobile phone, bit of course I am going to want to add keyboard support for it.

Keyboard events in client side javaScript involve attaching event handlers to the window object, because these kinds of events have to do with key presses in general, and not just touch events that have to do with just a canvas element.

There are two main events of interest the keydown and keyup events, the names of which should speak for themselves. I often use the key down event to set a boolean value to true, and then the key up to set it back to false, then use those boolean values to change things in an update loop. Another approach would be to make something that is more event driven with or without an update loop.

There is also using keyboard events in conjunction with rather than a replacement for touch events, and working out a general system for capturing use input. So lets look at some examples of canvas keyboard events, and input in general with canvas and javaScript.

Read More

Basic Canvas fractal example

I would say that Fractals are fun, the math can get a little challenging too so it is also an example of the kind of thing to get into these days when it comes to me trying to find novel and interesting things to do with javaScript.

I am always looking for more things to get into with javaScript purely for the sake of continuing to sharpen my skills, and just make more canvas examples to play around with. However fractals are also just simply a fun and interesting way to apply what I all ready know with javaScript in an artful way for what that is worth to me.

The basic idea of a fractal as I see it is that I am dealing with some kind of image pattern that repeats as I continue to zoom in or out. That might be a pretty crude definition that does not do the subject justice, but more often then not it would appear that is what a fractal is. So a very simple canvas fractal example could just be an animation of some squares getting bigger from a single starting point, and then looping back to that point once they get big enough. So that would maybe be a good starting point actually, but I would not stop there with this sort of thing.

Read More

A basic vue todo list app example

This will be a quick post on a basic vue list example. When working with unordered or ordered list elements in a template, typically I will end up using the vue for directive to bind to an array in the vue data object.

However there is just having a basic list example, and then there is staring to create an actual application that is a basic todo list application. So this will just be a pretty simple vuejs example of a todo list when it comes to getting this one out of the way.

Read More

Cannon shoot canvas example

This will be a post on a cannon shoot type game that will be the subject of yet another one of my canvas example posts. The idea here is to just keep making one canvas example after another until I manage to make one or two that might prove to be worth a higher investment of time if people show an interest in one. There are many games like this on the open Internet such as kitten cannon where the basic mechanics are than the player sets an angle and initial power value and then that is used to determine how far the object will go in a game map.

Anyway so this kind of game is just one of many different types of games that come to mind, and I figured that I should make at least one cannon shoot type game for this series of posts. Keep in mind that I rushed with this one, and there is much about it that I am not happy with, at least at the time of this writing anyway. I have a lot of these examples and thus far there are a few others that I would say have higher priority when it comes to improving the quality of the example.

Still I do have the basic idea of this kind of game working for what it is worth. There is just having a display object shoot off from a starting location and the initial heading and power can be set by a simple user interface. There is much more that could be added in terms of additional features beyond that, but I think the code could use some major clean up first.

Read More