dynamic-svg v0.0.1-alpha.1
Dynamic SVG Library
The Dynamic SVG Library (also DS) is a lightweight JavaScript library that allows you to create and manipulate SVG (Scalable Vector Graphics) elements dynamically in your web applications. With this library, you can generate and modify SVG graphics using JavaScript, opening up a world of possibilities for creating interactive and visually appealing content.
Features
Dynamically Create SVG Elements: Easily generate SVG elements such as shapes, lines, paths, and text using JavaScript code.
Interactive Manipulation: Modify attributes, styles, and properties of SVG elements on the fly to create interactive graphics.
Event Handling: Attach event listeners to SVG elements for handling user interactions like clicks, mouseover, and more.
Animation Support: Create animations using the built-in animation functions to bring your SVG graphics to life.
Custom Styling: Apply custom styles and animations to your SVG elements to match your application's design.
Getting Started
Installation
You can include the Dynamic-SVG library in your project using npm
:
npm install dynamic-svg
Usage
Import the needed modules in your file:
import Canvas from 'dynamic-svg/canvas';
Create an SVG container in your HTML where you want the SVG graphics to be displayed:
<div id="svg-container"></div>
Use JavaScript to dynamically create and manipulate SVG elements:
// Create a Canvas element const svgCanvas = new Canvas('svg-container'); // Create a circle element const circle = DynamicSVG.create('circle', { cx: 50, cy: 50, r: 30, fill: 'blue' }); // Attach a click event listener to the circle circle.addEventListener('click', () => { circle.configure({ fill: 'red' }); }); // Draw the element svgCanvas.draw(circle);
Examples
Check out the examples directory in the GitHub repository to see how you can use the library to create different types of SVG graphics and animations.
Contributing
Contributions are welcome! If you find a bug, have a feature request, or want to contribute in any way, please create an issue or submit a pull request to the GitHub repository.
License
This project is licensed under the MIT License.
Feel free to reach out to me at kovpak.maksym@gmail.com for any questions or assistance. I hope you enjoy using the Dynamic SVG library to enhance your web applications with dynamic and interactive SVG graphics!
2 years ago
2 years ago