Pages

marți, 19 septembrie 2017

Using processing.js to test ControlP5 .

The ControlP5 is a gui library written by Andreas Schlegel for the programming environment processing.
You can add this library open the processing IDE and under menu select Tools -> Add Tool ... . Use editbox to search the library named ControlP5 .
You can find many examples on official website.
Let's see how is look the Textarea GUI using processing IDE - official website example:


duminică, 17 septembrie 2017

Create 3D text with HTML 5 .

This is the result of this tutorial:

The example is simple and use two ways to draw text.
First use a function how make the text by using index variable to put on canvas same text.
The next use function strokeText to add to canvas the text.
The onload function is used to put on canvas all you need to see.
This is the source code for java script I used into head HTML5 tag :
window.onload = function(){
 var canvas = document.getElementById("3dCanvas");
 var canvasWidth = canvas.width;
 var canvasHeight = canvas.height;
 var ctx = canvas.getContext("2d");
 ctx.font = "20pt Verdana";
 ctx.fillStyle = "black";
 ctx.textAlign = "center";
 // first
 drawTextInCanvas(ctx , "graphic-3d.blogspot.com", canvasWidth/2, canvasHeight/2, 4);
 // the next
 ctx.strokeText('... read this website !', 150, 150);
};

function drawTextInCanvas(ctx, mytext, wdth, hght, dpth){
 var index;
 for (index = 0; index < dpth; index++) {
  ctx.fillText(mytext, wdth - index, hght - index);
 }

 // shadow casting in bottom layers
 ctx.fillStyle = "#30F30F";
 ctx.shadowColor = "black";
 ctx.shadowBlur = 6;
 ctx.shadowOffsetX = dpth+ 2;
 ctx.shadowOffsetY = dpth+ 2;
 ctx.fillText(mytext, wdth - index, hght - index);

}
Then add the canvas tag into body tag with this :
id="3dCanvas" width="400" height="200" style="border:1px solid black;"

Website tool for chemical data and infos.

Another website tool for chemical graphics and cheminformatics library.
The development team tell us:
The ChemDoodle Web Components library is a pure Javascript chemical graphics and cheminformatics library derived from the ChemDoodle® application and produced by iChemLabs. ChemDoodle Web Components allow the wielder to present publication quality 2D and 3D graphics and animations for chemical structures, reactions and spectra. Beyond graphics, this tool provides a framework for user interaction to create dynamic applications through web browsers, desktop platforms and mobile devices such as the iPhone, iPad and Android devices. This library also has complete access to the entire ChemDoodle desktop API through AJAX, allowing for quick access to one of the most robust chemical graphics and informatics packages in existence directly through Javascript. The goal of the project is to utilize the next-generation HTML5 technologies to power the scientific and educational applications of the future. iChemLabs is dedicated to funding, developing and hosting this library and has released it for free under the open-source GPL license. By releasing ChemDoodle Web Components open-source, yet continuing to financially support the library, iChemLabs ensures that the next generation of scientific applications is easily achievable by academia, government and industry, and helps to make sure that the cost of education decreases while using the web to further spread science.
This tool can be found on this website.

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.