Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
zrender is a lightweight canvas library that provides a powerful and flexible way to create and manipulate 2D graphics. It is often used as a rendering engine for the ECharts library, but it can also be used independently for custom graphics and animations.
Basic Shapes
This feature allows you to create basic shapes like circles, rectangles, and lines. The code sample demonstrates how to create a red circle and add it to the canvas.
const zrender = require('zrender');
const zr = zrender.init(document.getElementById('main'));
const circle = new zrender.Circle({
shape: {
cx: 150,
cy: 150,
r: 50
},
style: {
fill: 'red'
}
});
zr.add(circle);
Animations
This feature allows you to animate shapes. The code sample demonstrates how to animate a rectangle moving from one position to another over a duration of 1000 milliseconds.
const zrender = require('zrender');
const zr = zrender.init(document.getElementById('main'));
const rect = new zrender.Rect({
shape: {
x: 50,
y: 50,
width: 100,
height: 100
},
style: {
fill: 'blue'
}
});
zr.add(rect);
rect.animate('shape', true)
.when(1000, { x: 200 })
.start();
Event Handling
This feature allows you to handle events like click, mouseover, and mouseout on shapes. The code sample demonstrates how to add a click event listener to a circle that shows an alert when the circle is clicked.
const zrender = require('zrender');
const zr = zrender.init(document.getElementById('main'));
const circle = new zrender.Circle({
shape: {
cx: 150,
cy: 150,
r: 50
},
style: {
fill: 'green'
}
});
zr.add(circle);
circle.on('click', function () {
alert('Circle clicked!');
});
Fabric.js is a powerful and simple JavaScript HTML5 canvas library. It provides an interactive object model on top of the canvas element, allowing for complex shapes, animations, and event handling. Compared to zrender, Fabric.js offers more built-in functionalities for object manipulation and interaction.
Paper.js is an open-source vector graphics scripting framework that runs on top of the HTML5 Canvas. It is particularly well-suited for creating complex vector graphics and animations. Compared to zrender, Paper.js focuses more on vector graphics and provides a more extensive set of tools for path manipulation.
Konva.js is a 2D canvas library that extends the 2D context by enabling high-performance animations, transitions, and event handling. It is designed to be fast and easy to use. Compared to zrender, Konva.js offers a more straightforward API for creating and animating shapes, but it may not be as flexible for custom rendering needs.
A lightweight canvas library which providing 2d draw for ECharts
BSD 3-Clause License
Copyright (c) 2017, Baidu Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
FAQs
A lightweight graphic library providing 2d draw for Apache ECharts
The npm package zrender receives a total of 383,439 weekly downloads. As such, zrender popularity was classified as popular.
We found that zrender demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 18 open source maintainers collaborating on the project.
Did you know?
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.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.