在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):alexk111/SVG-Morpheus开源软件地址(OpenSource Url):https://github.com/alexk111/SVG-Morpheus开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):SVG MorpheusWARNINGTHIS PROJECT IS NOT MAINTAINED ANYMORE. You are free to fork it and start a new project. OverviewJavaScript library enabling SVG icons to morph from one to the other. It implements Material Design's Delightful Details transitions. Live demoInstallingUsing SVG Morpheus with a CDNCDN provided by cdnjs
DownloadYou have the following options to install the library:
Add ScriptSimply add the svg-morpheus.js script to your website/application. No other scripts are needed. Both the minified and uncompressed (for development) versions are in the /compile folder. <script src="svg-morpheus.js"></script> Usage
var myIcons = new SVGMorpheus('#myIconSet');
myIcons.to('icon1'); FunctionsSVGMorpheus ConstructorCreates a SVGMorpheus instance. var myIcons = new SVGMorpheus(element, options, callback); element - Object/IFrame/SVG element containing an icon set. Can be a DOM element or a CSS query selector. options - Optional. Object specifying default options. options.iconId - Optional. Id of an icon shown after initialization. Default: last icon in the icon set. options.duration - Optional. Set a default duration for transition animations, in msec. Default: 750. options.easing - Optional. Set a default easing for transition animations. Default: quad-in-out. options.rotation - Optional. Set a default rotation for icon shapes. callback - Optional. Set a default callback function to call at the animation end. SVGMorpheus.to()Morphs the icon to another one. myIcons.to(iconId, options, callback); iconId - Id of an icon to transition to. options - Optional. Object specifying the animation options. options.duration - Optional. Set a duration for the animation, in msec. options.easing - Optional. Set an easing for the animation. options.rotation - Optional. Set a rotation for icon shapes. callback - Optional. Set a callback function to call at the animation end. SVGMorpheus.registerEasing()Registers a custom easing function. SVGMorpheus has a set of predefined easing functions for the morph animation (goes below). If you want to use your own easing, use this function to do that. myIcons.registerEasing(name, fn); name - Name of an easing function you want to register. fn - Easing function. Predefined easing functions
Icon Set structureSVG should have the following structure to be a valid icon set:
<svg>
<g id="icon1">
Shape elements
</g>
<g id="icon2">
Shape elements
</g>
</svg> Example codeCheck the Demos directory for examples. Supported browsersChrome Firefox IE >= 10 Safari Opera iOS Safari Android Browser >= 4.4 Chrome for Android LicenseSee the LICENSE file. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论