Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

raphael

Package Overview
Dependencies
Maintainers
3
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

raphael

JavaScript Vector Library

  • 2.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
142K
decreased by-26.21%
Maintainers
3
Weekly downloads
 
Created

What is raphael?

Raphael is a small JavaScript library that simplifies working with vector graphics on the web. It provides an easy-to-use API for creating and manipulating SVG (Scalable Vector Graphics) elements, making it ideal for creating charts, graphs, and other visualizations.

What are raphael's main functionalities?

Creating Basic Shapes

This feature allows you to create basic shapes like circles, rectangles, and ellipses. The code sample demonstrates how to create a circle with a red fill.

const Raphael = require('raphael');
const paper = Raphael(10, 50, 320, 200);
const circle = paper.circle(50, 40, 10);
circle.attr('fill', '#f00');

Transformations

Raphael allows you to apply transformations to shapes, such as rotation, scaling, and translation. The code sample shows how to rotate a rectangle by 45 degrees.

const Raphael = require('raphael');
const paper = Raphael(10, 50, 320, 200);
const rect = paper.rect(10, 10, 50, 50);
rect.transform('r45');

Animations

You can animate shapes with Raphael. The code sample demonstrates how to animate a circle to increase its radius over 2 seconds.

const Raphael = require('raphael');
const paper = Raphael(10, 50, 320, 200);
const circle = paper.circle(50, 40, 10);
circle.animate({r: 20}, 2000);

Event Handling

Raphael supports event handling, allowing you to add interactivity to your graphics. The code sample shows how to change the fill color of a rectangle when it is clicked.

const Raphael = require('raphael');
const paper = Raphael(10, 50, 320, 200);
const rect = paper.rect(10, 10, 50, 50);
rect.click(function() {
  this.attr('fill', '#00f');
});

Other packages similar to raphael

Keywords

FAQs

Package last updated on 14 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc