Friday, November 30, 2012

Gradient on HTML5's Canvas

Bouncing Ball using Array on Canvas (without prototype method) in HTML 5

Here the code for this

Random Text in HTML 5 using Array and Canvas

Supernova: Partikel; batu kokoh di aliran sungai besar fanatisme

Ini bukan spoiler. Hm, atau sebisa mungkin bukan spoiler, :)

Sesore membaca Partikel, dengan Royyan yang tidur pulas disampingku.

Array and Canvas of HTML5 in Blogger

For some reasons, I wasn't able to display canvas consist of object with array. Dunnow,...

Seeking solution...

 UPDATE: It seems blogger didn't support prototype, so I have to improvise my code to adapt it.

The Bouncing Ball

The Code for this under the script tag

Bouncing Ball in HTML 5 using Canvas Method

A Result of Trial and Error

Here the code

Friday, November 16, 2012

Bouncing Ball using Array in HTML5

I want to create bouncing ball program that's very easy on Flash, Python or Delphi yet very tricky on html5. The program consist of n ball with random velocity (each) moving in a 2d box (oh yeah, square then :) ) 

I am playing with array in html5 script which is helpful on this program. I don't declare the array using

aBola = new array()

that come  as standart on many language, but prefer

aBola = []

instead, just like list on python. In this program, array's just like container for ball.

In html5, moving an object is a bit tricky and, for some Pascal programmer like me, bringing an old memory of draw-clear-draw-clear... cycle; draw a ball, delete it, draw the same ball but slightly right, delet it, ... and so on. All that kind of tedious job, but it worth for the sake of fast execution and no-need-slow-loading-flash-player thing.

Tuesday, November 13, 2012

2D/3D Ball Collision

I used on 1D collission problem where, in case of elastic collision, the ball is changing velocity each other. In 2D/3D case however, the collision is not always head-on collision (which is basically 1 dimension collision).

The system above's easy too solve, as simple as interchanging velocity (in elastic case).

Moving to HTML5

After years fighting the slow loading flash without alternative software, I begin to think seriously about moving to HTML5 coding. Altough it ain't true software for me, it provide what I need mostly: animation.

HTML5 support canvas, audio ad video tag, javascript. Need array data? No problem. If then else? OK.

So, begin...