jQuery 1.4 Animation Techniques - Index of
jQuery 1.4 Animation Techniques - Index of jQuery 1.4 Animation Techniques - Index of
}; context.beginPath(); context.moveTo(50, 50); context.lineTo(195, 125); context.lineTo(165, 125); context.lineTo(50, 66); context.fill(); context.closePath(); context.beginPath(); context.moveTo(450, 50); context.lineTo(305, 125); context.lineTo(275, 125); context.lineTo(422, 50); context.lineTo(450, 50); context.fill(); context.closePath(); context.beginPath(); context.moveTo(450, 250); context.lineTo(310, 175); context.lineTo(335, 175); context.lineTo(450, 235); context.lineTo(450, 250); context.fill(); context.closePath(); context.beginPath(); context.moveTo(50, 250); context.lineTo(200, 175); context.lineTo(225, 175); context.lineTo(80, 250); context.lineTo(50, 250); context.fill(); context.closePath(); if (window.ActiveXObject) { window.onload = function() { var context = canvas.getContext("2d"); draw(context); } } else { var context = canvas.getContext("2d"); draw(context); } [ 279 ] Chapter 10
Canvas Animations 3. Save the new page and view it in IE. Our flag should now be visible: IE can be made to understand the element, as we see in the previous screenshot, although its support is not completely identical to that of capable browsers. If we compare our example in IE and Firefox alongside each other, we see that IE also slightly enlarges the flag for some reason. What just happened? First of all we need to link to the explorercanvas library. We don't want to let normal browsers that support the native element use this file as it will slow them down, so we put the element into an IE-specific conditional comment (like we did with the html5shiv file earlier in the book). The .compiled version of the script file is simply a minified version for production use. The next change we make is to put the methods that draw the flag into an inline function stored as a variable. This is necessary because otherwise IE will attempt to use these drawing methods before the explorercanvas library has finished initializing and will throw errors. The next part of our code also deals with this. We use a conditional if statement to check for the presence of an ActiveXObject property of the window object (this will only exist in IE). If it is found, we attach an onload handler to the of the page that calls the getContext() method and our draw() function once the page has finished loading, and the explorercanvas library has done its thing. [ 280 ]
- Page 250: 2. In this example we used the dele
- Page 253 and 254: CSS3 Animations The following trans
- Page 255 and 256: CSS3 Animations Units It is of crit
- Page 257 and 258: CSS3 Animations Skew Remember the t
- Page 259 and 260: CSS3 Animations Calculating the sin
- Page 261 and 262: CSS3 Animations The filter property
- Page 263 and 264: CSS3 Animations If, like me, you th
- Page 265 and 266: CSS3 Animations } el.filters.item("
- Page 267 and 268: CSS3 Animations An unfortunate prob
- Page 269 and 270: CSS3 Animations The context of this
- Page 271 and 272: CSS3 Animations Time for action - i
- Page 273 and 274: CSS3 Animations The first variable
- Page 275 and 276: CSS3 Animations Time for action - a
- Page 277 and 278: Download from Wow! eBook CSS3 Anim
- Page 279 and 280: CSS3 Animations We also have to upd
- Page 281 and 282: CSS3 Animations flatMatrix[3] = fla
- Page 283 and 284: CSS3 Animations When updating the s
- Page 285 and 286: CSS3 Animations translate translate
- Page 287 and 288: Canvas Animations Subjects that we'
- Page 289 and 290: Canvas Animations We can set the co
- Page 291 and 292: Download from Wow! eBook Canvas An
- Page 293 and 294: Canvas Animations All imageData obj
- Page 295 and 296: Canvas Animations context.beginPath
- Page 297 and 298: Canvas Animations For the next part
- Page 299: Canvas Animations Time for action -
- Page 303 and 304: Canvas Animations Time for action -
- Page 305 and 306: Canvas Animations Once the rectangl
- Page 307 and 308: Canvas Animations We then define tw
- Page 309 and 310: Canvas Animations }, context.lineTo
- Page 311 and 312: Canvas Animations Creating a canvas
- Page 313 and 314: Canvas Animations Time for action -
- Page 315 and 316: Canvas Animations What just happene
- Page 317 and 318: Canvas Animations What just happene
- Page 319 and 320: Canvas Animations aliens.splice(x,
- Page 321 and 322: Canvas Animations Pop quiz - creati
- Page 323 and 324: Download from Wow! eBook
- Page 325 and 326: Pop Quiz Answers Using fadeToggle()
- Page 327 and 328: Pop Quiz Answers Using slideToggle
- Page 329 and 330: Pop Quiz Answers Implementing the p
- Page 331 and 332: Pop Quiz Answers Animating the canv
- Page 333 and 334: show() or hide() method, triggering
- Page 335 and 336: cssHooks using 239 cssHooks feature
- Page 337 and 338: fading animations 20 flicker effect
- Page 339 and 340: proximity animations about 207 exte
- Page 341 and 342: scaleY 232 skew 232 skewX 232 skewY
- Page 343 and 344: jQuery 1.4 Reference Guide ISBN: 97
};<br />
context.beginPath();<br />
context.moveTo(50, 50);<br />
context.lineTo(195, 125);<br />
context.lineTo(165, 125);<br />
context.lineTo(50, 66);<br />
context.fill();<br />
context.closePath();<br />
context.beginPath();<br />
context.moveTo(450, 50);<br />
context.lineTo(305, 125);<br />
context.lineTo(275, 125);<br />
context.lineTo(422, 50);<br />
context.lineTo(450, 50);<br />
context.fill();<br />
context.closePath();<br />
context.beginPath();<br />
context.moveTo(450, 250);<br />
context.lineTo(310, 175);<br />
context.lineTo(335, 175);<br />
context.lineTo(450, 235);<br />
context.lineTo(450, 250);<br />
context.fill();<br />
context.closePath();<br />
context.beginPath();<br />
context.moveTo(50, 250);<br />
context.lineTo(200, 175);<br />
context.lineTo(225, 175);<br />
context.lineTo(80, 250);<br />
context.lineTo(50, 250);<br />
context.fill();<br />
context.closePath();<br />
if (window.ActiveXObject) {<br />
window.onload = function() {<br />
var context = canvas.getContext("2d");<br />
draw(context);<br />
}<br />
} else {<br />
var context = canvas.getContext("2d");<br />
draw(context);<br />
}<br />
[ 279 ]<br />
Chapter 10