Tag Archives: javascript

Rainbow example with jQuery.

This simple example show you how to use jquery with html tags.

<!DOCTYPE html>
<title>rainbow example</title>
<script src=”../js/jquery-2.2.0.js”></script>
<script>for(d=document,i=0;k=i>>1,k<7;setTimeout(function(w){d.getElementById(w).id=”x”+w},555*k,i++))d.write(“<b id=”+i+”><style>b{width:0;height:0;transition:width 1s,height 1s;border-radius:70ex 70ex 0 0;position:fixed;bottom:-4ex}#x”+i+”{left:”+(9+4*k)+”ex;width:”+(80-6*k)+”ex;height:”+(40-3*k)+”ex;box-shadow:”+(i%2&&”inset 0″)+” 0 6ex hsl(“+50*k+”,99%,50%)}</style>”)</script>

Posted in All, HTML 5, javascript, Programming. Tagged with , , , .

JavaScript – highcharts.js chart library – part 001.

This library allow us to make charts for our data and infos. You can download it from code.highcharts.com.
Also you need to use modules if you want to export the chart like image, by using exporting.js from same website.
In this example the source code is very simple just you need to add it into your html5 file and set the data and settings for title, series. As can you see the series and categories has same number of elements. You need to put under xAxis and also to use curly brackets to set the intervals.

<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″>
<title>Highmaps Example 1</title>
<script type=”text/javascript” src=”https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js”></script>
<style type=”text/css”>
#container {
min-width: 300px;
max-width: 800px;
height: 300px;
margin: 1em auto;
<script src=”https://code.highcharts.com/highcharts.js”></script>
<script src=”https://code.highcharts.com/modules/exporting.js”></script>
<div id=”container”></div>
<script type=”text/javascript”>
Highcharts.chart(‘container’, {
title: {
text: ‘2015 – 2016 ‘,
subtitle: {
text: ‘inflation’
xAxis: {
categories: [‘2015 T1’, ‘2015 T2’, ‘2015 T3’, ‘2015 T4’, ‘2016 T1’]
series: [{ name:”inflation”,
data: [0.79, -1.55, -1.73, -0.93, -3.0],
type: ‘column’


Posted in All, javascript, Programming. Tagged with , , , .

JavaScript – Processing.js 2D library – part 002.

In the last tutorials I told you about studio sketchpad.
Another way to working with processing is to run your script into html files.
If you want to download the processing then you can get it from processing website.
The download will come with an integrated development environment.
If you want to use your processing sketch then you need to make some changes because I will got errors with the IDE.
The changes I make to fix that is to put into the top of your sketch Ball ball001; and MovingBall mb001;.
See the source code.

The most of this features can be found here.

Posted in All, HTML 5, javascript, Processing.js, Programming. Tagged with , , , , , , .

JavaScript – Processing.js 2D library – part 001.

This is part 001 from tutorials series about Processing.js.
The javascript library Processing help us to create one good interface with our javascript.
This library come with many features to show into canvas data and infos and also to create 2D and 3D interfaces.
I used to show this features one online editor named studio sketchpad and can be found here
Using this online editor can help you but if you want to use all features then you need to put the library into your html file.
In this tutorial I just use the online editor and later will come with another tutorials about how to set the library.
Make one account of this online editor if you want to save your work.
The development is simple and has some rules.
The script will have two functions setup – for settings and draw – basically will draw the canvas.

This will fill with functions, statements and all the commands available to Processing.js.
Take a look at page references.
On the bottom of the script can also make classes.
This will be created like this:

As can we see classes comes without void and args ().
Let’s how it’s works classes by using two : Ball and MovingBall.
If you want to make one class and then you need to used then use this steps:
– create the class Ball;
– add two functions: update and display;
– add also the possition of the class by using two float variables x,y ;
– because any class need to have one instance then you need one,so put this instance into the class and named like the class Ball;
– this instance will need to take the possition and then to used so you need also two variables: _x and _y;
– if you want to show it then also you need a display function with some 2D/3D primitives;
Also the classes can be created not just to show you the 2D/3D primitives.
Let’s see the source code of this class named Ball.

Let’s make another class named MovingBall.
This class will be like the Ball class and will be extended by Ball class.
This means the all content of Ball class can be used or not by MovingBall.

This MovingBall has the MovingBall extends the Ball with _x,_y and also used super to reference the superclass of a subclass. Take a look where is put the variables x,y and _x,_y into the Ball and MovingBall.
The Ball will get _x,_y possitions and will give it to x,y, also the MovingBall will follow the same rules.
Now I will add one function to MovingBall named drawline, see:

This will set the sets the color used to draw lines and borders around shapes with stroke function and will make one line from x,y to 0,0.
When will run this function will have one line.
Let’s see the MovingBall class:

The first step when you want to using this library is to know how to set the canvas and how to change it.
The size of this canvas can be done with this function: size.
For example : size(400,400) means 400 pixels x 400 pixels.
The background can be change it with background() function and sets the color used for the background.
The smooth function will draw all geometry with smooth (anti-aliased) edges.
Because we want to draw something then you need to fill the setup and draw functions.
Also into setup function will put the new created classes and will used into draw function to draw.
Let’s see the final source code:

You can see my example here:

Posted in All, HTML 5, javascript, Processing.js, Programming. Tagged with , , , , , , .

News: jQuery 3.0 Beta Released.

The team member of jQuery Core – Timmy Willison tell us in a blog post about Query 3.0 Beta Released.
Developers with jQuery 3.0 alpha had experimented with methods like an inline-display-none-remover (.show()) and inline-display-none-adder (.hide()) and removing inline display:none did not always show the element.
Fix the custom selectors like :visible make is up to 17 times faster now.
Link jQuery with :

…or get the beta version from npm:

Posted in news. Tagged with , , , , .