Pages

sâmbătă, 16 septembrie 2017

The Santa Tracker website for kids.

This website will help with the education of the children and more so will prepare you for the winter holidays.
Start in this adventure by clicking on the icon with the upper left lines and you have access to Santa's surprises.

vineri, 15 septembrie 2017

Using processing.js to make a rotating ball effect .

This tutorial show us how to make a rotating ball effect. You can see the background is not black and the reason is the background is set just into setup function. Another part of this effect is the rect function from draw. This rect will clean the ball. The ball is a ecllipse function with a size a 10. The pushMatrix function pushes the current transformation matrix onto the matrix stack.
float angle;
int dist_ball = 100;

void setup() {
  size(800, 600);
  background(0);
}

void draw() {
  fill(20,20);

  noStroke();
  rect(0,0,width, height);
  fill(255);

  translate(width/2, height/2);

  rotate(angle);

  pushMatrix();
   rotate(angle);
   translate(dist_ball,0);
   ellipse(0, 0, 10, 10);
  popMatrix();
 
  angle += 0.1;
}
The result is this effect:

Chrome - fix WebGL issue.

This error can be show you with Chrome browser.

To fix this you need to try this ways :
First, You need to open into browser settings into new tab: chrome://settings .
See if the Use hardware acceleration when available under Advance is set to True, if not then set this to True .
Take a look at chrome://gpu into new tab and see if is something with red color.
This may be a problem and try to see what is this error. Also check the chrome://flags and wee the WebGL options you have it.
For example: I fix my WebGL by enabling the WebGL Draft Extensions even the webgl CheckerImaging: Disabled is show with the red color on tab chrome://gpu.
This can be enable under chrome://flags.
The WebGL Draft Extensions Mac, Windows, Linux, Chrome OS, Android allow us:
Enabling this option allows web applications to access the WebGL Extensions that are still in draft status.

miercuri, 13 septembrie 2017

Using processing.js to make a clock.

Is a simple way to make and test processing.js online by using this online tool.
First you need to sign in into your account and use button : Create a Sketches .
This will open your open the editor. Now you need to add this source code:
void setup() {
  size(200, 200);
  stroke(10);
  smooth();
}
void draw() {
  background(255);
  fill(0);
  noStroke();
  // Angles for sin() and cos() start at 3 o'clock;
  // subtract HALF_PI to make them start at the top
  ellipse(100, 100, 160, 160);
  float s = map(second(), 0, 60, 0, TWO_PI) - HALF_PI;
  float m = map(minute(), 0, 60, 0, TWO_PI) - HALF_PI;
  float h = map(hour() % 12, 0, 12, 0, TWO_PI) - HALF_PI;
  stroke(255);
  strokeWeight(1);
  line(100, 100, cos(s) * 72 + 100, sin(s) * 72 + 100);
  strokeWeight(2);
  line(100, 100, cos(m) * 60 + 100, sin(m) * 60 + 100);
  strokeWeight(4);
  line(100, 100, cos(h) * 50 + 100, sin(h) * 50 + 100);
}
The source code is simple:

  • one first function setup will set size area and some line settings; 
  • the draw function loops continuously to draw your work. 

Into the draw function I create a clock design and the movement is follow by time.
Because this is analog clock , I used sin functions to move the line to show the analog clock hands for time.
Take a look into the right area and will see three vertical dots.
Use mouse and a side panel will show you. In this panel you can set Settings and upload Files.
The Settings will come with the Mode to set the javascript - P5js/Processingjs and Tabs to show/hide your work.
Let's see how is working: