Hybrid Icon Animation plugin tutorial based on HTML5 svg and rapha?l.js

Source: Internet
Author: User

First, installation
$ NPM Install Hybicon
$ Bower Install Hybicon

Ii. Methods of Use
<script src= "Js/required/raphael.min.js" ></script>
<script src= "Js/hybicon.min.js" ></script>

Third, HTML structure
<div data-hybicon= "Icon1-icon2" ></div>
The location of the icon can be set by the Data-hybicon-positioning property.
<div data-hybicon= "Github-star"
data-hybicon-positioning= "Topright|center|topleft" ></div>

(1) Mouse slide over mode
By setting the Data-hybicon-hovermode property you can animate the second icon in a mouse-over animation.
<div data-hybicon= "Code-fave" data-hybicon-hovermode= "Show|rotate|switch" ></div>

(2) Mouse click mode
You can animate the second icon when the mouse clicks by setting the Data-hybicon-clickmode property.
<div data-hybicon= "Icon1-icon2" data-hybicon-clickmode= "Show|rotate|switch" ></div>

(3) Information mode
<div data-hybicon= "Download-code"
Data-hybicon-infomode= "show|right-*width*"
data-hybicon-infotext= "*your text*" >
</div>

(4) Hyperlinks
If you need to add a hyperlink to an icon, you can simply use a <a> element to wrap the <div> element.
<a href= "Documentation.html#hyperlink" ><div data-hybicon= "link" ></div></a>

(5) Advanced mode
<div data-hybicon= "Arrowright-arrowright"
data-hybicon-icon1init= "20,50,25,0"
Data-hybicon-icon1anim= "35,50,30,180"
data-hybicon-icon2init= "80,50,25,180"
Data-hybicon-icon2anim= "65,50,30,0"
Data-hybicon-animtime= "600"
Data-hybicon-animease= "Bounce"
Data-hybicon-clickmode>
</div>

(6) Use of third-party icons
var myicons={
Triangle: "M0,100,l100,100,l50,20,z",
Rectangle: "M0,0,l100,0,l100,100,l0,100,z"
}

<div data-hybicon-iconclass= "Myicons"
data-hybicon= "Triangle-rectangle"
data-hybicon-clickmode= "Rotate" >
<div>

(7) How to align the icons
<div data-hybicon= "Icons" data-hybicon-align= "Left|center|right" "></div>

(8) The size of the picture
<div data-hybicon data-hybicon-size= "unit in px| ' CSS ' for responsive behaviour ' ></div>

(9) Background color of the icon
<div data-hybicon= "Github-star" data-hybicon-background= "as CSS background" ></div>

(10) Color of the icon
<div data-hybicon= "Github-star" data-hybicon-color= "as CSS color" ></div>

(11) Border of the icon
<div data-hybicon= "Github-star" data-hybicon-border= "as CSS border" ></div>

(12) Fillet border
<div data-hybicon= "Github-star" data-hybicon-borderradius= "as CSS Border-radius" ></div>

Four, CSS style
<div id= "Myhybicon"
data-hybicon= "User-idea"
data-hybicon-hovermode= "Switch"
Data-hybicon-infomode
Data-hybicon-size= "CSS" >
</div>

#myHybicon {
width:222px;
height:222px;
}

#myHybicon-svg {
Background: #FFF;
border-radius:15%;
}

#myHybicon-icon1 {
Fill: #333;
}

#myHybicon-icon2 {
Fill: #FFF;
Stroke: #F6921E;
stroke-width:0.5;
}

#myHybicon-info {
Fill: #604c3b;
Stroke: #604c3b;
Stroke-width:3;
}

#myHybicon-infotext {
Fill: #FFF;
font:11px Impact, Sans-serif;
}

Keymob is the most exclusive mobile advertising alliance in the country, through the integration of advertisers and mobile Internet resources, for advertisers to quickly improve product performance and brand image, for advertisers to create greater value.

Hybrid Icon Animation plugin tutorial based on HTML5 svg and rapha?l.js

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.