
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
react-raphael
Advanced tools
reactify raphael
# or specify the externals in webpack config
npm install --save raphael
# install react-raphael in your react-raphael project
npm install --save react-raphael
var React = require('react');
var ReactDOM = require('react-dom');
const {Raphael,Paper,Set,Circle,Ellipse,Image,Rect,Text,Path,Line} = require('react-raphael');
class App extends React.Component{
render(){
var data = [
{x:50,y:50,r:40,attr:{"stroke":"#0b8ac9","stroke-width":5},animate:Raphael.animation({cx:60},500,"<>")},
{x:100,y:100,r:40,attr:{"stroke":"#f0c620","stroke-width":5},animate:Raphael.animation({cx:105},500,"<>")},
{x:150,y:50,r:40,attr:{"stroke":"#1a1a1a","stroke-width":5}},
{x:200,y:100,r:40,attr:{"stroke":"#10a54a","stroke-width":5},animate:Raphael.animation({cx:195},500,"<>")},
{x:250,y:50,r:40,attr:{"stroke":"#e11032","stroke-width":5},animate:Raphael.animation({cx:240},500,"<>")}
]
return (<Paper width={300} height={300}>
<Set>
{
data.map(function(ele,pos){
return (<Circle key={pos} x={ele.x} y={ele.y} r={ele.r} attr={ele.attr} animate={ele.animate}/>)
})
}
</Set>
<Set>
<Rect x={30} y={148} width={240} height={150} attr={{"fill":"#10a54a","stroke":"#f0c620","stroke-width":5}}/>
<Ellipse x={150} y={198} ry={40} rx={100} attr={{"fill":"#fff","stroke":"#e11032"}} glow={{width:10,fill:true,color:"#0b8ac9",opacity:1}}/>
<Image src="static/images/5circle.png" x={100} y={170} width={90} height={60} />
<Text x={150} y={258} text="同一个世界 同一个梦想" attr={{"fill":"#fff"}}/>
<Text x={150} y={273} text="One World One Dream" attr={{"fill":"#fff"}}/>
<Path d={["M150 287L150 287"]} animate={Raphael.animation({"path": ["M80 287L220 287"]},500,"<>")} attr={{"stroke":"#fff"}}/>
<Line x1={150} y1={290} x2={150} y2={290} animate={Raphael.animation({ x1:80, x2:220},500,"<>")} attr={{"stroke":"#fff"}}/>
</Set>
</Paper>)
}
}
number
width of the canvas.number
height of the canvas.object
props of the canvas's container.default value: { style:{}, className:"" }
object
Sets the attributes of the element.object
Creates and starts animation for given element.object
Acts similar to Element.animate, but ensure that given animation runs in sync with another given element.function
Adds event handler for click for the element.object
Adds or retrieves given value asociated with given key.function
Adds event handler for double click for the element.object
Adds event handlers for drag of the element. object {move,start,end,mcontext,scontext,econtext}
function
Return set of elements that create glow-like effect around given element.object
Adds event handlers for hover for the element. object {in,out,icontext,ocontext}
boolean
Makes element invisible.function
Adds event handler for mousedown for the element.function
Adds event handler for mousemove for the element.function
Adds event handler for mouseout for the element.function
Adds event handler for mouseover for the element.function
Adds event handler for mouseup for the element.function
Adds event handler for load for the element.object
Adds rotation by given angle around given point to the list of transformations of the element.object
Adds scale by given amount relative to given point to the list of transformations of the element.boolen
Stops animation for given element.boolean
Moves the element so it is the furthest from the viewer’s eyes, behind other elements.boolean
Moves the element so it is the closest to the viewer’s eyes, on top of other elements.function
Adds event handler for touchcancel for the element.function
Adds event handler for touchend for the element.function
Adds event handler for touchmove for the element.function
Adds event handler for touchstart for the element.string
or array
Adds transformation to the element which is separate to other attributes, i.e. translation doesn’t change x or y of the rectange. The format of transformation string is similar to the path string syntax:"t100,100r30,100,100s2,2,100,100r45s1.5"
object
Adds translation by given amount to the list of transformations of the element.function
Adds event handler for update for the element.Extends Element & Container Elements
Extends Element & Draws a circle
number
x coordinate of the centrenumber
y coordinate of the centrenumber
radiusExtends Element & Draws a ellipse
number
x coordinate of the centrenumber
y coordinate of the centrenumber
horizontal radiusnumber
vertical radiusExtends Element & Embeds an image into the surface
string
URI of the source imagenumber
x coordinate of the centrenumber
y coordinate of the centrenumber
width of the imagenumber
height of the imageExtends Element & Creates a path element by given path data string
string
path string in SVG formatExtends Element & Creates set of shapes to represent given font at given position with given size
number
x position of the textnumber
y position of the textstring
text to printstring
family of font objectstring
weight of font objectstring
style of font objectstring
stretch of font objectnumber
size of the font, default is 16string
could be "baseline" or "middle", default is "middle"number
number in range -1..1, default is 0Extends Element & Draws a circle
number
x coordinate of the top left cornernumber
y coordinate of the top left cornernumber
width of the rectnumber
height of the rectnumber
radius for rounded corners, default is 0Extends Element & Draws a text string & If you need line breaks, put “\n” in the string
number
x coordinate positionnumber
y coordinate positionstring
The text string to drawExtends Path & Draws a line
number
x coordinate of the start pointnumber
y coordinate of the start pointnumber
x coordinate of the end pointnumber
y coordinate of the end pointfunction
paper of the componentfunction
set of the componentfunction
element of the componentyou can see
http://dmitrybaranovskiy.github.io/raphael/reference.html#Raphaelfunction
create a paper by Raphael()
function
update a paperfunction
remove a paperfunction
create elements or a set by paper.xxx
function
call create to create a elementfunction
call create to create a setfunction
update elements or a setfunction
remove a set from paperfunction
remove a element from paperarray
all paper instancearray
all elements or set of the only paper instancefunction
find parent of element by idEmail: liuhong1.happy@163.com
FAQs
reactify raphael
The npm package react-raphael receives a total of 902 weekly downloads. As such, react-raphael popularity was classified as not popular.
We found that react-raphael demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.