HTML5+CSS 3D/2D Canvas Animation Library taccgl

for Plug-In free, cross html5 browser, open source graphics.

animate
HTML5+CSS elements
3D Objects from scene files
Deformed, sliced, mapped elements
Canvas Drawings
with
GPU based WebGL™
Lighting and Shading
Hidden Surfaces
Automatic Shadows
fallback to 2D canvas
 
 

Easy use with HTML5, CSS, and javaScript, Features, Tutorial

3D Objects on HTML+CSS Pages

There exist good 3D modelling programs (commercial and open source) to create 3D models. By placing the created model files on your web server and with 2 lines of javaScript code you can insert such object into a web page. more

Beta Version 0.57 Released

HTML5 Canvas 3D Animation

Version 0.57 was released on July 25,2014 and Version 0.56 on June 19, 2014, more

Now the development of mobile and responsive sites is explicitely supported and a beta of the mobile home page of taccgl™ demonstrates this. Read more about development of Responsive and Mobile Layouts. Also the taccgl™ tutorial and most of the documentation pages now have a responsive layout.

The library now also works locally on file:/ / urls (see Installing the Library) and can so be tested without the need of a web server (local or remote).

This is a beta release and quite naturally it contains bugs and is not yet completely implemented (e.g. does not yet implement all HTML tags and not all CSS properties). See Restrictions. We would be happy for bug reports and comments.

taccgl™ is provided under an open source BSD like License. You can download the library and place it on your test web server.

WebGL™ is a trademark of the Khronos Group Inc.

 

Pop-Up Animations with no more than 4 Lines of

javaScript useful for pop-up/alert/dialog boxes, for tool-tips and status infos, for drop-down and pop-up menues etc. more

CSS Transition Visibility

Comparision of taccgl™ transitions and CSS transitions for the visibility property. more

CSS Transition Display

CSS transitions on the Height property can gradually display / un-display elements in a way that other elements fill up the resulting empty space, like display:none, which does not work gradually. These can easily be combined with taccgl™ transitions more

Morphing and Deforming of CSS formatted HTML elements

HTML5 Canvas Animation
taccgl™ includes functions for deformation and morphing of HTML elements. For example an element can be morphed from a rectangle into a circle or it can be mapped on an uneven waveformed surface more

WebGL™ for 2D and flat HTML/CSS Pages

Although WebGL™ is mostly seen as a pure 3D technique, it in fact provides direct access to the GPU and so can be used benefically for 2D as well to

  • create fast 2D animations of HTML/CSS elements, smoothly animating many thousand elements or parts of elements taking benefit of GPU acceleration
  • manipulate every pixel displayed for an HTML/CSS element using HTML canvas operations

taccgl™ enables Close integration of HTML, CSS and WebGL™

taccgl™ can see an HTML page with its HTML elements and possibly additional 3D objects as a single 3D scene and so provide

  • correct display of HTML/CSS elements appearing in front of each other, hiding invisible elements (also partially)
  • display of 3D objects read from 3D model files and alignment with the HTML elements
  • lighting for HTML/CSS elements and 3D objects by simulating a light source
  • automatic calculation and display of consistent shadows including shadows of partially transparent elements and shadows on uneven surfaces.

Examples

Mouseovers based on WebGL™
Enlarging 3D Objects on this page
External 3D Models:
Temple Show Case
Templerhaus Show Case
Mobile taccgl™ Homepage
Further reading:

If you like taccgl™ please share it with others, e.g. link to us, refer to us in social networks, or follow us on twitter etc.

When showing, viewing, or developing animations and/or computer games take care about epilepsy. A warning message shows up before viewing the examples.

is a fast Script Library to animate HTML+CSS pages in 2D and 3D using HTML 5 canvas, tries to use WebGL™ and hardware graphic acceleration with 2D canvas fall-back. It integrates well with HTML and CSS to animate CSS formatted HTML elements (like <img> and <p>).

Under good conditions the library directly uses hardware graphic acceleration and its performance critical parts run directly on the computers graphic unit. This provides an extreme performance gain compared to DOM and script based animations and allows you to run smooth animations with thousands of elements.

If no hardware acceleration is present (or if it is not usable because of the browser or the graphics driver) the library uses the HTML 5 - 2D canvas which provides quite fast animations with restricted features on fast computers as well.

For slow graphic accelerators and/or slow processors that can not handle the full screen resolution smoothly, the library plays the animations only on a portion of the screen or becomes completely inactive to not interfere normal operations on the page.

On older browsers that do not support HTML 5 canvas and no animations show up.

The library is written in JavaScript and GLSL (a C like vector programming language). If supported, the GLSL parts are downloaded into the graphics card and executed there; possibly in parallel on several processors, which gives a dramatic performance gain.
taccgl™ is an HTML 5 library making special use of the new canvas feature. HTML 5 means that the library explicitly runs only on newer browsers, e.g. IE 9.0 and up, current versions of most other browsers. For older browsers it becomes inactive, the idea is that users can still view pages that include the library, however without the animations.

taccgl™ can display CSS formatted HTML elements with the new HTML5 3D canvas which makes the benefits of canvas 3D available for HTML elements as well:

For example HTML elements can be animated using GPU acceleration, they can be moved, accelerated, deformed, bent, lighted etc. and they can enjoy the performance of the GPU which normally has enough power to separately animate thousands of copies of (parts or fragments of) HTML elements.

Also HTML elements can be fully integrated into a 3D scene, e.g. they can rotate in 3D, they can be displayed before or behind other HTML elements even partially, and they can cast shadows or shadows can be casted on them. In addition HTML elements can be mapped on 3D objects such as cubes or spheres.

taccgl™ allows you to create WebGL™ animations with very few lines of javascript, by
  • animating CSS formatted HTML elements
  • mapping of HTML elements on 3D objects
  • displaying 3D objects created with a modelling program (e.g. Blender) and aligning them with HTML and CSS

The new HTML 5 canvas feature in its 3D version brings fantastic new graphic and animation features, such as

  • direct access to the clients GPU graphic acceleration unit,
  • performing of animations with thousands of triangles,
  • separately controlling every pixel and to calculate each pixel's color once per frame,
  • loading shader programs into and executing them in the GPU thereby bypassing javaScript and DOM performance bottelnecks,

and also special 3D features such as

  • 3D depth buffering for hidden surface handling,
  • 3D lighting for simulating light sources and reflection on 3D objects, and
  • automatic 3D shadow calculation.

In pure HTML 5 canvas 3D/WebGL™ the content to be displayed must be individually programmed. The taccgl™ library greatly simplifies this process. by allowing the user to use CSS formatted HTML elements togehter with 3D Models created with a modelling program.

Hover or click on the various green links on this page to see pop-ups containing additional explanations.

The appearing pop-up window is displayed using taccgl™ and WebGL™, mostly (performance of the GPU permitting) to correctly display its shadows. Note that the shadow can be quite complex, since the underlying page is not flat but seen as a 3D surface.

In addition opening and closing animations are played. The opening animation is choosen randomly from various opening animations that are e.g. morphing the element from a circle or a wavs from to its final rectangular form. The closing animation makes the element explode into many parts.

Hover or click on the various 3D objects and screenshots to see animations enlarging and rotating the objects.

taccgl™ Features

  • Library for 2D and 3D graphics and text, transitions and animations using WebGL™ for Webdesign of general purpose HTML pages.
  • Detect browsers/clients without appropiate WebGL™ and keep pages operational; assist in or automatically showing alternative content (e.g. canvas 2D)
  • Animates CSS formatted elements, Canvas 2D drawings, parts, slices, and deformed fragments thereof, and 3D objects from model files.
  • Provides transitions for linear and accelerated motion, rotation, color, fading, clipping, growing, shrinking, texture motion, deformation, morphing, etc as detailed below.
  • Consistent hidden surface handling, lighting, and shadows over all animated elements including HTML elements and 3D objects.
  • Perform many thousands of parallel transitions using GPU acceleration.
  • Per pixel calculation of lighting, colors, shadows, and user defined functions.
  • Easy content creation with HTML, CSS, and simple javaScript.
  • Fluent interface to apply transitions on multiple selected elements/objects.
  • Initial and permanent measurements and estimates of performance and frame rate and based on that Fall-Back and Graceful Degradation mechanisms for browsers/clients that do not support WebGL with the required performance including, disabeling shadows, dynamically reducing canvas size, using HTML5 canvas 2D instead of WebGL™, and finally completely disabeling animations (e.g. IE 8).
  • Depending on client/browser uses HTML 5 canvas 3D (WebGL™) or canvas 2D.
  • Even in canvas 2D mode simulates some 3D features, see below.
  • Animates 3D Models (OBJ and MTL files) in WebGL™ Mode.
  • Automatically generated and user defined shader programs.
  • Open source, BSD like license.
 
2D Features Details/Demo 3D Features Details/Demo WebGL™ Features Details/Demo
Linear Motion
Accelerated Motion
Rotation around given axis
Rotation around given axis and center
Animate HTML Elements ( Restr.)
Animate Canvas Drawings
HTML coordinate system
Animating Background Color
Fading/Blending
Clipping/Resizing
Grow and Shrink Animations
Mapping of HTML elements
Texture Motion
Continuation of transitions
Continuation with constant velocity
Morphing into Circles or Waves (WebGL Mode)
Lighting (WebGL Mode)
(in WebGL mode and in fallback mode:)
Linear and Accelerated Motion in 3D
Rotation around axis and center in 3D
Compatible with HTML coordinates
Boxes
Objects with rectangular Faces
(in fallback mode without WebGL:)
Parallel Projection
Limited Hidden Surface Handling

Multiple Operations
select HTML elements of CSS class
select HTML elements with name
select HTML elements with tag name
apply transitions to sets of elements
cut transitions into horizontal/vertical slices
Handle Sets of Transitions

(available in WebGL™ mode)
all 2D and 3D Features listed already with
full Perpective Projection and
full hidden surface Handling
execution of transitions inside the GPU as shader programs
HTML elements with flexible Borders
Display of 3D Models from OBJ/MTL Files
Selection of objects from 3D Models
Alignment of 3D Models / HTML elements
Mapping of HTML elements on 3D Models
ambient, diffuse, and specular Lighting
per vertex or per fragment Lighting
Shader Generation
Custom Shaders

3D Features

In fact most of the animations shown in 2D so far work in 3D as well: Move back (z>0) and forward (z<0), Rotate around X, Y, and Z axis, Move and Rotate around X, Y, and Z axis, Rotate around XY, YZ, and XZ diagonal,

All HTML/CSS elements displayed normally appear in a z=0 plane. Elements displayed using taccgl™ use the same x and y coordinates (in pixel with oringin in the top left corner of the current window or frame) and may have a positive z coordinate when moving behind and a negative z coordinate for moving in front.

3D Elements

Turing an Element into a 3D-box : Box Test Logo Box Some Logo Boxes More Boxes 300 Boxes
Map various HTML elements on surfaces Introduction Cube
3D object with rectangular faces: Multi Face Object

Multiples

Select multiple elements and perform animation: Rotate all a tags.
Create 50 slices and Rotate in sequence.
Create 500 slices and Rotate in sequence.
Create 5000 slices and Rotate in sequence.

Show Multiple Copies
Move Multiple Copies

WebGL™ Features

If taccgl™ uses 3D canvas or WebGL™ then all the 2D and 3D features are performed using WebGL™ and with full WebGL™ performance. In addition the following additional features are available:

Hidden Surface Elimination / Depth Buffering

Correclty displays Elements depth information, even if elements cross each other, see also Introduction Cube

Display of 3D Models in OBJ file format

Simple Display, Selection of one or more objects from the model, Strech Display, Positioning of the Model on HTML elements, many alignment options 1 2 3 4, Rotation 1 2 3 4, 1 2 3 4,

Mapping of HTML Elements on 3D Objects

HTML elements can be mapped on 3D models either complete or with UV mapping.

Lighting

Per fragment lighting: seperately controlable ambient, diffuse, and specular lighting Emphasized Ambient, Emphasized Diffuse, no Specular, Emphasized Specular, and Emphasized Specular with low Shininess.

Custom Shaders

Allow the user to programmtically control every point Circle Blend, Center Blend, and Rotating Blend.

Features Overview
2D Features
3D Features
WebGL™ Features
Documentaion
Create Animations with HTML 5, CSS, and WebGL™
Canvas 2D / WebGL™ provides extraordinary 2D and 3D graphic
taccgl™ makes it easy to use
create content with HTML5 and CSS, animate with WebGL™
and add 3D objects designed with a modelling tool
<div id="el" style="border:3px solid black; ...">
I am an actor
</div>
Animate with simple javascript functions :
e.g. rotate around X axis
taccgl.actor("el").rotateMiddle(1,0,0).duration(4).start()
e.g. perform multiple rotations and motions on multiple copies of an element
e.g. Turn into a box and rotate
taccgl.actor("el",taccgl.dddBox).depth(150).rotateMiddle(.7,.7,0).duration(4).start()
e.g. Map other HTML elements and colors to various faces of the box and continue rotating.
e.g. rotate around Y axis
taccgl.actor("el").rotateMiddle(0,1,0).duration(4).start()
WebGL™ is a trademark of the Khronos Group Inc.

Content in HTML (as usual) and Eye Candy with taccgl™

Canvas (vs. CSS) makes animations faster and more flexible.
Canvas 3D (WebGL™): complex anmiations in full 3D.
Continue