A framework to create SVG graphics

Slides:



Advertisements
Similar presentations
Emerging Platform#5: Processing 2 B. Ramamurthy 6/13/2014B. Ramamurthy, CS6511.
Advertisements

Iframes & Images Using HTML.
2.744 Dreamweaver Tutorial Sangmok Han Feb 24, 2010.
Lecture # 11 JavaScript Graphics. Scalable Vector Graphics (SVG) Scalable Vector Graphics (SVG), as the name implies, are - scalable (without pixelation):
Neal Stublen Why Use a Canvas?  Flexibility… Use of drawing primitives (lines, arcs, text) Direct access to element display pixels.
Chapter 6 Photoshop and ImageReady: Part II The Web Warrior Guide to Web Design Technologies.
HTML 5 Previous version: HTML4.01, 1999 Still work in progress, most browsers support some of it.
Introduction to SVG & Batik Presented by Shang-Ming Huang.
Director of Computer Center, DaYeh University Ku-Yaw Chang.
Lesson 25: Multimedia with Macromedia Flash 8. Objectives Identify Shockwave-Flash (SWF) technology features and authoring software Add SWF animation.
WMD Creating Animations Flash-5 Zhou Hong. Contents Review 1 Frame Types 2 Frame-by-Frame Animation 3 Action & Shape Tweening 4.
Images (1) Three most popular formats – Graphics Interchange Format (GIF) – Joint Photographic Experts Group (JPEG) – Portable Network Graphics (PNG) –
Intro to Dreamweaver Web Design Section 7-1 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development I” Course.
New Tags, New Attributes, New JavaScript APIs, Forms, Validation, Audio, Video, SVG, Canvas Doncho Minkov Telerik Corporation Technical.
HTML5 – The Power of HTML5 – The Power of Thomas Lewis HTML5 Principal Technical Evangelist Microsoft | asimplepixel.tumblr.com.
Working with Objects Creating a Dynamic Web Page.
Introduction to Applets CS 3505 Client Side Scripting with applets.
HTML 5 Tutorial Chapter 5 Canvas. Canvas The tag is used to display graphics. The Canvas is a rectangular area we control each and every pixel of it.
Canvas academy.zariba.com 1. Lecture Content 1.What is Canvas? 2.Including Canvas in your HTML 3.Commands in Canvas 4.Drawing Shapes with Canvas 5.Animations.
Session: 17. © Aptech Ltd. 2Canvas and JavaScript / Session 17  Describe Canvas in HTML5  Explain the procedure to draw lines  Explain the procedure.
Processing.js.
Presented by Nassib Awad
Element. The element Used to dynamically draw graphics using javascript. Capable of drawing paths, circles, rectangles, text, and images.
Chapter 9 Fireworks: Part I The Web Warrior Guide to Web Design Technologies.
Doing the Canvas the "easy way"! Learning & Development Telerik Software Academy.
Unleash the Power of jQuery Doncho Minkov Telerik Software Academy academy.telerik.com Senior Technical Trainer
SVG for Designers Tom Hoferek. Objectives Introduce SVG Illustrate its capabilities Demonstrate SVG in action Speculate, discuss, answer questions.
Lecture 16 Image Document Formats. Bitmap vs. Vector Images Bitmaps do not generally.
Return to Outline Copyright © 2011 by Maribeth H. Price 3-1 Labeling and annotation.
Unleash the Power of jQuery Learning & Development Team Telerik Software Academy.
Map Books & Dynamic Tables
UNDERSTANDING HTML Tags VS Attributes. Element An element in HTML represents some kind of structure and generally consists of a start tag, content, and.
HTML – Other Tags Semantic Tags, Frames, Embed Multimedia Content, Others SoftUni Team Technical Trainers Software University
HTML – Other Tags Semantic Tags, Frames, Embed Multimedia Content, Others SoftUni Team Technical Trainers Software University
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
Programming games Context of what we are doing. Drawing on canvas. Homework: [Complete coin toss examples.] Do your own drawings. Upload files to website.
11/12/2015 Box Model Reed Crouch. 11/12/2015  HTML elements can be considered as boxes. In CSS, the term "box model" is used when referring to layout.
CSS Transitions and Animations Animated HTML Elements SoftUni Team Technical Trainers Software University
Adding Interactivity Comp 140 Fall Web 2.0 Major change in internet usage –From mostly static pages Text Graphics Simple links –To new paradigm.
07 – HTML5 Canvas (1) Informatics Department Parahyangan Catholic University.
CSS Layout Cascading Style Sheets. Lesson Overview  In this lesson, we’ll cover:  Brief CSS review  Creating sections with the tag  Creating inline.
HTML5 and CSS3 Illustrated Unit F: Inserting and Working with Images.
HTML 5 (Part 1) – Start from SCRATCH. HTML 5 – Start from SCRATCH.
Part – 3 : HTML 5 SVG Tag. † SVG stands for Scalable Vector Graphics. † SVG is used to define vector-based graphics for the Web. † SVG defines the graphics.
Advanced Elements & Advanced HTML Codes AGCJ 407.
Dreamweaver MX. 2 Timeline Overview (p. 480) n Animations can be achieved with DHTML (__________ HTML) using JavaScript code and _____ or later browsers.
Unit 15 – Web Authoring Web Authoring Project.
Creating Visual Effects
SVG & DOM Manipulation via Javascript
XmlBlocks xml-based blocks.
CSS3 Style of the HTML document CSS2+New Specifications Differences
Front-End Framework for Responsive Web Sites
Inserting and Working with Images
Canvas Notes
Creating Visual Effects and Animation
CSS Transitions and Animations
CSS Transitions and Animations
Building beautiful and interactive apps with HTML5 & CSS3
Revision.
Introduction to D3.js and Bar Chart in D3.js
Skills learned in Lab 1 Web GUI framework HTML tags and attributes
ISC440: Web Programming II Ch14: HTML5 Canvas
Chris Shuster Exploring JavaFX.
The Canvas.
D3.js Tutorial (Hands on Session)
Drawing Graphics in JavaScript
D3.js Tutorial (Hands on Session)
Graphics Canvas.
Week 10 - HTML SVG Student: Vladislovas Karalius
JavaScript – Let’s Draw!
Presentation transcript:

A framework to create SVG graphics Raphael A framework to create SVG graphics Telerik Software Academy Learning & Development http://academy.telerik.com

Table of Contents Raphael Raphael features Overview and setup Creating shapes Setting attributes Animations

Raphael Overview and setup

Raphael Raphael is a JavaScript framework for working with SVG shapes Dynamically, with JavaScript Setting up Raphael: Download the script from the site Include the script into the HTML page: Instantiate Raphael object: Ready to go <script src='scripts/raphael-min.js'></script> var paper = Raphael(10, 10, 500, 500);

Raphael Setup Live Demo

Raphael Shapes

Raphael Shapes Raphael has all the basic shapes: Rect: Circle: Path: var rect = paper.rect(x, y, width, height); Circle: var circle = paper.circle(cx, cy, radius); Path: var path = paper.path(points);

Raphael Shapes Live Demo

Shape Properties

Shape Properties Shapes created with Raphael have settable properties To change fill color, stroke, etc… var rect = paper.rect(50, 90, 180, 80); rect.attr({ fill: 'purple', stroke: 'blue', 'stroke-width': 10 }) .rotate(25, 170, 140);

Shape Properties Shapes created with Raphael have settable properties To change fill color, stroke, etc… var rect = paper.rect(50, 90, 180, 80); rect.attr({ fill: 'purple', stroke: 'blue', 'stroke-width': 10 }) .rotate(25, 170, 140); The attr() methods gets an object

Method calls can be chained Shape Properties Shapes created with Raphael have settable properties To change fill color, stroke, etc… var rect = paper.rect(50, 90, 180, 80); rect.attr({ fill: 'purple', stroke: 'blue', 'stroke-width': 10 }) .rotate(25, 170, 140); The attr() methods gets an object Method calls can be chained

Shape Properties Live Demo

Grouping elements together Raphael Sets Grouping elements together

Raphael Sets Sets in Raphael allow to change the attributes of a group of elements at once The shapes can be of any type: Rects Circles Text Images

Raphael Sets: Example Change the attr of a group of elements at once Start a set with setStart() paper.setStart();

Raphael Sets: Example Change the attr of a group of elements at once Start a set with setStart() paper.setStart(); Add the shapes paper.setStart(); paper.circle(75, 85, 75); paper.rect(160, 85, 75, 45); paper.text(10, 200, 'This is the text');

Raphael Sets: Example Change the attr of a group of elements at once Start a set with setStart() paper.setStart(); Add the shapes paper.setStart(); paper.circle(75, 85, 75); paper.rect(160, 85, 75, 45); paper.text(10, 200, 'This is the text'); Finish the set and save it in variable var set = setFinish();

Raphael Sets: Example Change the attr of a group of elements at once Start a set with setStart() paper.setStart(); Add the shapes paper.setStart(); paper.circle(75, 85, 75); paper.rect(160, 85, 75, 45); paper.text(10, 200, 'This is the text'); Finish the set and save it in variable var set = setFinish(); Set properties set.attr({ … });

Raphael Sets Live Demo

Raphael for SVG http://academy.telerik.com

Homework Create the following images using Raphael: Create a spiral with Raphael *Hint: use many circles with radius 1px