Yet yet another cube

Web July 1st, 2007

I made a huge mistake on the last post, Yet another cube. In that post, I attached a quick-n-dirty implementation of dojox.gfx3d that work in Firefox only. Unfortunately, no source code is attached except gfx3d.js and a symbol link to my home directory. I untared the tar ball, and it worked, of course it just linked to my working copy! Here is the current snapshot.

In this implementation, I took the lazy evaluation, thanks to Eugene’s advice:
Once a 3D object is created in dojox.gfx3d.Viewport, only meta is recorded. The real DOM node is not constructed till the last minute, when dojox.gfx3d.render is called. That simplify the development and eliminate the dependencies of SVG and VML renders under the hood.

Cube in Firefox and MSIE



Above is screenshot in Firefox 2.0 and MSIE 6.0, you can see the inconsistence of the coordination system, we would fix that later. And here are more to consider:

  • Scene support so we can apply the world transform in a group of objects
  • Texture support: solid and gradient for more sophisticated texture
  • Z-order

Once we solve these problem, the next step is just to propagate it to other more complicated objects.

All roads lead to Roma

Web August 21st, 2006

Well, the Roma is a little different in different aspectives.

VML assume the gradient starts/ends from 0%/100%, so VML render discard the start/end information; the gradient vector is mimiced by the rotation.

Here are the screenshots of linear gradients on VML(left) and SVG(right):

1. Two stops: { 5%, #F60 }, { 95%, #FF6 }
with gradient vector: {x1:0, y1:0, x2:75, y2:50}

Linear gradient with two stops


The differences are quite subtle.

2. Three stops: { 5%, #F60 }, { 55%, #FAF }, { 95%, #FF6 }
with gradient vector: {x1:0, y1:0, x2:75, y2:50}

Linear gradient with three stops


The intermediate stop in VML plays a more important role compared with SVG.

Can you handle SVG?

Gentoo, Web July 6th, 2006

I felt stupid of wasting several hours to debug/test the SVG pattern support in Firefox 1.5.0.4 when I found that Mozilla Firefox did not support this feature at all. The browser even could not render the SVG example from the specification.

Thanks for Gavin’s advice, I emerged the Opera. The test cases run flawlessly, all the SVG features supported by dojo 2D are rendered correctly. Bow to Opera developers!

So far, I have 6 browsers installed in my Gentoo laptop:

  • Firefox 1.5.0.4
  • Konqueror 3.5.3
  • Opera 9.00 build 344
  • Microsoft Internet Explorer 6.0.2800.1106 (w/Wine)
  • Links 2.1pre20
  • Lynx 2.8.5rel.5

Anybody know how to run Safari on Linux?

SVG + Animation

Web July 4th, 2006

Dojo has developed the dojo.animation.* framework for simple animation development. What if we combine the power of Animation and SVG? Here we go:

jc = new dojo.animation.Animation(new dojo.math.curves.Circle([dx,dy], 150), 8000, 0, -1, 25);
dojo.event.connect(jc, "onAnimate", function(e) {
      jupiter.setCircle( {cx:e.x, cy:e.y } );
});

This snippet is quite straightforward, we specify the animation trace( circle), duration(8000ms), acceleration(0), repeated times( -1 stands for forever), then build the animation object; hook the onAnimation to the callback function. Done!

onAnimate event will generates the coordination according the trace, we then manipulate the SVG object’s position in the the callback function. Check out the example for the synergy of two. You need Mozilla Firefox 1.5+ to watch the animation.

dojo-svg kicks off

Web June 23rd, 2006

Before this project is launched, dojo’s developers have made significant progress to explore how to integrate SVG support. Another candidate for the back-end render engine is VML. There are two projects in dojo SoC 2006, dojo-svg & dojo-vml, a universal interface is developed to glue the Gfx API and various back-end rendering engine. I prefer dojo-svg, since VML is only rendered within Microsoft Internet Explorer, while SVG is supported natively by Mozilla Firefox 1.5+, or any browsers with Adobe SVG plugin.

SVG is a complicated protocol, current specification is 1.1, v1.2 draft is still in progress. The good news is I don’t need to implement all the features of the specification, current work is still a proof of correctness. Here is a snapshot of the current achievement.
dojo-svg Snapshot 06/26/2006