Click here to Skip to main content
Click here to Skip to main content
Articles » Web Development » ASP.NET » Samples » Downloads
Add your own
alternative version

xLibrary - Using a custom IHttpHandler to access embedded JavaScript

, 28 Feb 2009 CPOL
This article covers how to make a custom IHttpHandler to use the X Library from embedded in an assembly.
// xAniOpacity r1, Copyright 2006-2007 Michael Foster (
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL

function xAniOpacity(e, o, t, a, oe)
  if (!(e=xGetElementById(e))) return;
  var o0 = xOpacity(e); // start value
  var dx = o - o0; // displacement
  var fq = 1 / t; // frequency
  if (a) fq *= (Math.PI / 2);
  var t0 = new Date().getTime(); // start time
  var tmr = setInterval(
    function() {
      var et = new Date().getTime() - t0; // elapsed time
      if (et < t) {
        var f = et * fq; // constant velocity
        if (a == 1) f = Math.sin(f); // sine acceleration
        else if (a == 2) f = 1 - Math.cos(f); // cosine acceleration
        f = Math.abs(f);
        xOpacity(e, f * dx + o0); // instantaneous value
      else {
        xOpacity(e, o); // target value
        if (typeof oe == 'function') oe(); // 'onEnd' handler
        else if (typeof oe == 'string') eval(oe);
    }, 10 // timer resolution

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Rick Bassham
Software Developer (Senior)
United States United States
I have been a software developer since 2005, focusing on .Net applications with MS SQL backends, and recently, C++ applications in Linux, Mac OS X, and Windows.
Follow on   Twitter   Google+

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150414.1 | Last Updated 28 Feb 2009
Article Copyright 2007 by Rick Bassham
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid