Created
February 22, 2009 09:17
-
-
Save magmoro/68412 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function vmlImage(props){ | |
var left=(props.left||0)-1; | |
var top=(props.top||0)-1; | |
var width=props.width+1; | |
var height=props.height+1; | |
var rect=new Element('v:rect',{ | |
styles:{ | |
width: width, | |
height: height, | |
left: left, | |
top: top, | |
position: 'absolute', | |
clip: 'rect(1px '+width+'px '+height+'px 1px)' | |
}, | |
stroked:false | |
}).adopt( | |
new Element('v:fill',{ | |
src: props.src, | |
type: 'tile', | |
position: 1/width+','+1/height | |
}) | |
); | |
return rect; | |
} | |
var myVmlImage=vmlImage({ | |
src: 'homer-simpson.jpg', | |
width:500, | |
height:500, | |
left:10, | |
top:10 | |
}).inject(document.body); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment