Images

You can create Images using cdf.Image constructor.

// setMidHandle will set pivot coordinates to center of image.
// also this very function will postpone the seting until the image is loaded
// to set it once (browser does not know the image size until it's loaded)

var img = new cdf.Image('../../meta/examples/media/cog.png').setMidHandle();
cdf.animate(function(t){
  c.clear();

  // Drawing first image at 50 by x and center by y,
  // alpha = 1 rotated by t degrees scaled by 0.3
  img.draw(c, 50 ,c.cy,1,t, 0.3,0.3);

  // Drawing another one, rotated by -t (opposite rotation)
  // minus 15 degrees to create illusion of cogs.
  img.draw(c, 122 ,c.cy,1,-t-15, 0.3,0.3);
});

The cog ©paomedia, from small-n-flat icon set - github.com/paomedia/small-n-flat