The description of code is given in inline comments.
Code:
<div id="container"></div>
<button id="show">Show</button>
<script src="http://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"> </script>
<script>
var paper = Raphael(10, 50, 960, 860);
// we need 6 rectangle to draw television
// the below 3 rectangles are used for drawing Telivision
var rect1 = paper.rect(300, 100, 200, 100).attr({
fill: 'gray',
stroke: 'red',
'stroke-width': 1,
cursor: 'pointer'
});
var rect2 = paper.rect(390, 200, 12, 25).attr({
fill: 'gray',
stroke: 'red',
'stroke-width': 1,
cursor: 'pointer'
});
var rect3 = paper.rect(300, 225, 200, 10).attr({
fill: 'gray',
stroke: 'red',
'stroke-width': 1,
cursor: 'pointer'
});
//////////////////////////////////////////////
// the below 3 rectangles are used for Telivision holder
var rect4 = paper.rect(250, 235, 300, 15).attr({
fill: 'blue',
stroke: 'red',
'stroke-width': 0,
cursor: 'pointer'
});
var rect5 = paper.rect(280, 250, 13,150).attr({
fill: 'blue',
stroke: 'red',
'stroke-width': 0,
cursor: 'pointer'
});
var rect6 = paper.rect(500, 250, 13,150).attr({
fill: 'blue',
stroke: 'red',
'stroke-width': 0,
cursor: 'pointer'
});
///////////////////////////////////////////////////////////////
var dot = paper.circle(650, 300, 60).attr({
fill: 'gray',
stroke: 'blue',
'stroke-width': 1,
cursor: 'pointer'
});
var e = paper.ellipse(650, 100, 40, 80).attr({fill: 'orange', stroke:"red"});
var tetronimo = paper.path("M 600 380 l 100 0 l 17 22 l -20 0 l 0 -10 l -90 0 l 0 10 l -20 0z").attr({
fill: 'gray',
stroke: 'blue',
'stroke-width': 1,
cursor: 'pointer'
});
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function DrawTriangleOnPaper(x,y,ax,ay,bx,by){
// typical structure of the triangle
var trianglePath = [["M",x,y],["L",ax,ay],["L",bx,by],["Z"]];
var discattr = {fill: "yellow",stroke: "1"};
var triangle = paper.path(trianglePath).attr({
fill: 'blue',
stroke: 'red',
'stroke-width': 1,
}); // Draw the triangle
// The below code creates yellow circles formoving the triangle
// using below circles we have created the effects
cont = paper.set(
paper.circle(x, y, 5).attr(discattr),
paper.circle(ax, ay, 5).attr(discattr),
paper.circle(bx, by, 5).attr(discattr));
//We create the update to ove the circle position
cont[0].update = function(mouseX,mouseY) {
var newX = this.attr("cx") + mouseX;
var newY = this.attr("cy") + mouseY;
this.attr({cx:newX,cy:newY}
);
trianglePath[0][1] = newX;
trianglePath[0][2] = newY;
triangle.attr({path: trianglePath});
}
cont[1].update = function(mouseX,mouseY) {
var newX = this.attr("cx") + mouseX;
var newY = this.attr("cy") + mouseY;
this.attr({cx:newX,cy:newY});
trianglePath[1][1] = newX;
trianglePath[1][2] = newY;
triangle.attr({path:trianglePath});
}
cont[2].update = function(mouseX,mouseY) {
var newX = this.attr("cx") + mouseX;
var newY = this.attr("cy") + mouseY;
this.attr({cx:newX,cy:newY});
trianglePath[2][1] = newX;
trianglePath[2][2] = newY;
triangle.attr({path:trianglePath})
}
// setting the functions on drag
cont.drag(moveMouse,upMouse);
}
function moveMouse(mouseX,mouseY){
this.update(mouseX - (this.mouseX ||0) ,mouseY - (this.mouseY || 0));
this.mouseX = mouseX;
this.mouseY = mouseY;
console.log(mouseX)
console.log('=')
console.log(mouseY)
}
function upMouse(){
this.mouseX = this.mouseY = 0;
}
DrawTriangleOnPaper(150,210,200,300,100,300);
// for drawing the line
var rectangle = paper.rect(140, 300, 10, 300).attr({
fill: 'blue',
stroke: 'blue',
'stroke-width': 1,
cursor: 'pointer'
});
// for drawing the rectangle below the triangle
var rectangle = paper.rect(100, 600, 100, 30).attr({
fill: 'blue',
stroke: 'blue',
'stroke-width': 1,
cursor: 'pointer'
});
// Creating the button events
var button = document.getElementById('show');
button.onclick = function () {
console.log("hi")
dot.animate({
fill: '#005'
}, 500);
};
</script>
Screnshot:
Output :
Bonus Laboratory-Raphael JS 1. Using Raphael, create the following shapes: 2. Add some events and effects.
his assignment will help the student by: Create shapes using Java code Using and creating colors with Java Coding JFrames and using the Graphics g method Using Loops (to draw) Your program will generate a drawing using java. You should draw an object that makes sense, not just spare shapes and colors. You must use at least 3 different shapes You must use at least 2 different fonts You must use at least 2 predefined java colors and one custom-made...
Using the Graphics object g, create the following shapes 50, 100 5) Now draw that same circle except use 50,100 as its center point
Please write SQL Query for following questions using Northwind Database: 1. Create a procedure to add a new record to Territories table. Call it NewTerr. Add the following records using the procedure. TerritoryID TerritoryDescription Region 88888 Brooklyn 1 99999 Waco 4 77777 Long Beach 2 2. Create an Update Procedure that will change the Region from 1 to 3 for record with TerritoryID 88888. Call it Update88. 3. Create a Delete Procedure that will delete the one record from...
ASSIGNMENT: Create a program to do the following: BONUS: A bonus of 20 points if you create the program in such a way that there is no limit on the number of names to be handled. 1) Read in names to sort until the user types the “enter” key as the first character of a “C-type” string (the maximum number of names is 20, there is not a maximum length to a name), using a two dimensional array of characters....
4. (35 pts) Consider the system defined by: xit 5x1-2x2-R (1) #2-2x, +2x2 F) a) Compute the natural frequencies and the mode shapes. /dland -JS -2N5 b) Calculate the response for F(t)-F(t)-0 and initial conditions xo- e) Calculate the response for F-cosr, F,(o)-0 and initial conditions and -0. 0 d) Calculate Bi and B2 such that the system: -2x1 + 2x2-B2cos/6t does not experience resonance.
4. (35 pts) Consider the system defined by: xit 5x1-2x2-R (1) #2-2x, +2x2 F) a)...
Using R, solve these problems:
1)
2)
3)
Exercises • Create a vector grades=c(88,90,70,50) • Add names to the vector: Jon Snow, Tyrion, Arya, Cersei • Delete Cersei grade • Change Arya grade to 85 Exercises • Create the following vector [roquefort, ham, chicken liver, beef tongue, beef heart, mozzarella, watermelon] • Create a logical vector: True if you like the food, False otherwise. • Use the logical vector to select the food you like. • Create a new vector...
1. Create a few tables using mysql workbench, try to add data then take a screenshot
Requirements 1. Analyze the effects of the events on the accounting equation of Aaron Woody CPA. Use a format similar to Exhibit 1-5. 2. Prepare the following financial statements: a. Income statement. b. Statement of retained earnings. c. Balance sheet bjectives 4, 5 P1-53B Using the accounting equation for transaction analysis and preparing financial statements Aimee Griffin recently opened her own law office, which she operates as a corpo- ration. The name of the new entity is Aimee Griffin, Attorney....
1 ili Shape Outline Shapes Arrange Quick Styles Shape Effects Drawing Replace Select- nt 2 Paragraph 5 Editing Quiz 4 Immersive Incorporated reports an increase in Accounts Payable of $9,200 and an increase in inventory of $45,000 for the current year. Accounts Payable relates solely to the purchase of merchandise. Sales on account were $532,100 and cost of goods sold was $358,000. The payments to suppliers for inventory during the period were:
please add some step by step
please add some step by step
Chemistry 30: Unit 1 Review Hand In Assignment Name: School: Include your answer with correct units and significant figures. If you use a formula, be sure to include it as well. 6. Write the formula for each of the following: (1 mark each) a. Butane b. Aluminum Hydroxide C. Dihydrogen monoxide d. Nickel (II) oxalate 7. Write the name of each of the following compounds: (1 mark each)...