- Go to Solution Explorer
- Right-click on the Application name
- Select Add-->add new item
- Now in the window that opens, select an HTML page or new Web form
- Rename it to LINEARPOINTER.aspx
Step 2 : In this section we will create the style for the media and create the .css on the media screen. Put the given script in the Head section of the HTML or in between the <head>--</head> tags.
Here two CSS files are used for design purposes; one is for the section div, named d1.css and the other d2.css for the whole body of the web page.
d1.css scripting
body
{
background: #00688B;
color: #fff;
font: 300 100.1% "Helvetica Neue" , Helvetica, "Arial Unicode MS" , Arial, sans-serif;
}
#holder
{
height: 442px;
left: 42%;
margin: -240px 0 0 -320px;
position: absolute;
top: 57%;
width: 842px;
font-size: x-large;
background-color: #008000;
}
#duplicate {
bottom: 0;
font: 300 .7em "Helvetica Neue", Helvetica, ;
position: absolute;
right: 1em;
text-align: right;
}
#duplicate d {
color: #fff;
}
d2.css scripting.
body {
background: #fff;
color: #000;
font: 100.1% "Comic Sans MS", Lucida, Verdana, sans-serif;
}
#holder {
height: 480px;
left: 50%;
margin: 0 0 0 -320px;
position: absolute;
top: 0;
width: 640px;
}
#duplicate {
bottom: 0;
font-size: .7em;
position: absolute;
right: 1em;
text-align: right;
}
Step 3 : In this part we need to work on some JavaScript. For fully understanding how the JavaScript works download the attached .rar file and run the linearpointer application.
The whole JavaScript looks as in the following.
Color(function ()
{
var r = Color("holder"),
choice = document.getElementById("choice"),
choice1 = document.getElementById("choice1"),
run = document.getElementById("execute"),
set = r.set(r.circle(300, 200, 8), r.circle(200, 100, 8), r.circle(100, 200, 8), r.circle(200, 300, 8), r.circle(200, 200, 8)).attr({ stroke: "none", fill: "#666" }),
c = r.circle(200, 200, 10).attr({ stroke: "#fff", "stroke-width": 4 }),
fade = function (id)
{
return function ()
{
set[id].attr({ fill: "#fff", r: 12 }).animate({ fill: "#666", r: 8 }, 500);
};
};
run.onclick = function ()
{
var ex = choice.value,
ey = choice1.value;
c.stop().animate({
"20%": { cy: 200, easing: ey, callback: fade(0) },
"40%": { cy: 100, easing: ey, callback: fade(1) },
"60%": { cy: 200, easing: ey, callback: fade(2) },
"80%": { cy: 300, easing: ey, callback: fade(3) },
"100%": { cy: 200, easing: ey, callback: fade(4) }
}, 5000).animate({
"20%": { cx: 300, easing: ex },
"40%": { cx: 200, easing: ex },
"60%": { cx: 100, easing: ex },
"80%": { cx: 200, easing: ex },
"100%": { cx: 200, easing: ex }
}, 5000);
};
});
Step 4 : In this section we are going to become familiar with the body part of HTML scripting. Replace this script from the body section of the LINEARPOINTER.aspx page. Here we pass a #holder in the div id that is defined in the d1.css file.
<body>
<center>
<h2>LINEARPOINTER MOVING</h2>
<hr />
<div id="holder"></div>
<div id="form">
<select id="choice">
<option value="">Linear</option>
<option value=">">Ease In</option>
<option value="<">Ease Out</option>
<option value="<>">Ease In and Out</option>
<option value="bounce">Bounce</option>
<option value="elastic">Elastic</option>
<option value="backIn">Back In</option>
<option value="backOut">Back Out</option>
</select>
<select id="choice1">
<option value="">Linear</option>
<option value=">">Ease In</option>
<option value="<">Ease Out</option>
<option value="<>">Ease In and Out</option>
<option value="bounce">Bounce</option>
<option value="elastic">Elastic</option>
<option value="backIn">Back In</option>
<option value="backOut">Back Out</option>
</select>
<button id="execute">Action Button</button>
</div>
</center>
</body>
Step 5 : The complete code for the linearpointer application is:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="LINEARPOINTER.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="d1.css" media="screen">
<link rel="stylesheet" href="d2.css" media="print">
<style media="screen">
#holder {
height: 400px;
margin: -200px 0 0 -200px;
width: 400px;
}
#form {
position: absolute;
top: 50%;
left: 50%;
width: 400px;
height: 100px;
margin: -200px 0 0 -200px;
}
</style>
<script src="javascript.js"></script>
<script>
</script>
</head>
<body>
<center>
<h2>LINEARPOINTER MOVING</h2>
<hr />
<div id="holder"></div>
<div id="form">
<select id="choice">
<option value="">Linear</option>
<option value=">">Ease In</option>
<option value="<">Ease Out</option>
<option value="<>">Ease In and Out</option>
<option value="bounce">Bounce</option>
<option value="elastic">Elastic</option>
<option value="backIn">Back In</option>
<option value="backOut">Back Out</option>
</select>
<select id="choice1">
<option value="">Linear</option>
<option value=">">Ease In</option>
<option value="<">Ease Out</option>
<option value="<>">Ease In and Out</option>
<option value="bounce">Bounce</option>
<option value="elastic">Elastic</option>
<option value="backIn">Back In</option>
<option value="backOut">Back Out</option>
</select>
<button id="execute">Action Button</button>
</div>
</center>
</body>
</html>
Step 6 : Output Press F5
Note : For the accurate output of HTML5 applications, you must have the Google Chrome browser in your PC. You will see we rotated the image while the image is displaying in the browser.
Select your choices.
After changing the options you will see.
Here are the some useful resources.
Explore generating visualizations using JavaScript in HTML5
Pointers in C#
How Count Sort works
Create Slider Carousel Images Using HTML5
Dynamic and static Rectangle in WPF