Skip to content

Commit

Permalink
example in README tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
pissang committed Mar 30, 2018
1 parent 38760fd commit d9014ff
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

ClayGL is a WebGL graphic library for building scalable Web3D applications.

It's easy to use, configurable for high-quality graphics. Benefit from the modularity and tree shaking, it can be scaled down to 30k(gzipped) for a basic 3D application.
It's easy to use, configurable for high-quality graphics. Benefit from the modularity and tree shaking, it can be scaled down to 22k(gzipped) for a basic 3D application.

#### [Download](https://github.com/pissang/claygl/releases)

Expand Down Expand Up @@ -85,10 +85,10 @@ It's easy to use, configurable for high-quality graphics. Benefit from the modul

#### Minimum bundle example

This example is about 28k(gzipped) after bundled by webpack 4.0. It draws a triangle on the screen.
This example is about 22k(gzipped) after bundled by webpack 4.0. It draws a triangle on the screen.

```js
import { Renderer, Geometry, Shader, Material } from 'claygl';
import { Renderer, GeometryBase, Shader, Material } from 'claygl';

const vsCode = `
attribute vec3 position: POSITION;
Expand All @@ -106,13 +106,16 @@ const renderer = new Renderer({
canvas: document.getElementById('main')
});
renderer.resize(400, 400);
const geometry = new Geometry();

const geometry = new GeometryBase();
geometry.createAttribute('position', 'float', 3);
// Add triangle vertices to position attribute.
geometry.attributes.position.fromArray([
[-0.5, -0.5, 0],
[0.5, -0.5, 0],
[0, 0.5, 0]
]);

const material = new Material({
shader: new Shader(vsCode, fsCode)
});
Expand Down

0 comments on commit d9014ff

Please sign in to comment.