background preloader


Facebook Twitter

Snap.svg - drag event handler. Snap.svg - Track cursor with Snap-SVG. Text masking with snap.svg. Alex Normand - How to show/hide an element and add/remove classes from an element with Snap.svg. These last couple of weeks I've been working a lot with Snap.svg.

Alex Normand - How to show/hide an element and add/remove classes from an element with Snap.svg

Snap.svg is a revamped version of Raphael which only supports modern browsers, i.e. those who fully support SVG. This allows Snap.svg to support all of SVG's cool features such as masking, clipping, groups, ... Unfortunately there are no built-in methods to hide or show an element, or to add and/or remove classes from a given element and apply CSS transitions and animations. However it is very easy to extend Snap.svg. I extended the Element prototype like so: To use these functions: var s = Snap(450, 450); var rect = s.rect(150, 150, 75, 75); // show rect rect.toggle(true); // hide rect rect.hide() rect.toggle(false); // toggle rect rect.toggle() // add classes to rect rect.addClass('class1 class2 class3'); // remove classes from rect rect.removeClass('class1 class2 class3'); // toggle classes rect.toggleClass('class1'); rect.toggleClass('class1', true); rect.toggleClass('class1', false);

Top javascript librarys to work with SVG’s. What are SVG’s ?

Top javascript librarys to work with SVG’s

According to W3C, SVG (Scalable Vector Graphics) is a markup language for describing two-dimensional graphics applications and images, and a set of related graphics script interfaces. It is a vector graphics format intended primarily for the Web, though it is getting wider deployment on a variety of devices.

Why use it? – When you zoom in on a raster image (like png, jpg or gif) it becomes “pixelated”, but when you zoom in on a vector image, it remains clear at any resolution. – Vector graphics can often have a smaller file size (especially when compressed) than the equivalent raster image We know that are some Javascript SVG libraries/frameworks out there, but we searched the best of them for you. Processing.js Processing.js makes your data visualizations, digital art, interactive animations, educational graphs, video games, etc. work using web standards and without any plug-ins.

Raphaël.js JSDrawing SVG Web PlotKit PlotKit is a Chart and Graph Plotting Library for Javascript. Snap.svg - Home. Raphaël—JavaScript Library. Implementing a Flowchart with SVG and AngularJS. Download - 305.2 KB Contents Overview This article documents the development of a small exploratory project for flowchart visualization and editing that is built upon SVG and AngularJS.

Implementing a Flowchart with SVG and AngularJS

It makes good use of the MVVM pattern so that UI logic can be unit-tested. After so many articles on WPF it may come as a surprise that I now have an article on web UI. Professionally I have been using web UI in some pretty interesting ways connected to game development. It seemed only natural that I should take my NetworkView WPF article and bring it over to web UI. During development of the code I have certainly moved my skills forward in many areas, including Javascript, TDD, SVG and AngularJS.

A little over a year ago I started developing using TDD, something I always wanted to do when working with WPF, but never got around to it (or really appreciated the power of it). My first attempt at NetworkView, in WPF, took a long time. I set my sights much lower. Screenshot Audience What and Why? Playing with snap SVG. //Call it like that new $.AnimatedSvgTextNode( svg_node ).crumble(); * Rapid jQuery OO, from * @param svgTxtNode * @constructor $.AnimatedSvgTextNode = function( svgTxtNode ) { console.log( "$.AnimatedSvgTextNode" ); //HTML element + snap + jquery this.snap = svgTxtNode; this.element = svgTxtNode.node this.

Playing with snap SVG

//Font needed attribute this.initFontSize = this.snap.attr( "font-size" ); this.initFontInt = parseInt( this.initFontSize );