/    Sign up×
Community /Pin to ProfileBookmark

why the matrix filter does not work in ie

This is a post first posted at s[URL=”http://stackoverflow.com/questions/13739807/why-the-matrix-filter-does-not-work-in-ie”]tackoverflow[/URL],but I got no answer,so I post it here,once get an solution,I will post it at stackoverflow.

I try to rotate the elment in ie, so I use the matrix filter,html:

[code=html]<div id=”car” style=”position: absolute; width: 52px; height: 26px; -moz-transform: rotate(45deg); left: 20px; top:206px; z-index: 1000;”>
<img src=”http://i.stack.imgur.com/dcwtR.png” />
</div>
[/code]

Then add the filter:

[CODE] var a=document.getElementById(“car”),b=45;
a.style.filter = ‘progid:DXImageTransform.Microsoft.Matrix(sizingmethod=”auto expand”)’;
var e = Math.cos(b * Math.PI / 180),
c = Math.sin(b * Math.PI / 180),
g = a.filters.item(0);
g.M11 = g.M22 = e;
g.M21 = -c;
g.M12 = c;[/CODE]

Then the div is rotated, but there are a black outline around the image.

[URL=”JsFiddle”]JsFiddle[/URL]

Note the black outline:[ATTACH=CONFIG]15259[/ATTACH]

[canned-message]attachments-removed-during-migration[/canned-message]

to post a comment
CSS

3 Comments(s)

Copy linkTweet thisAlerts:
@rtretheweyDec 07.2012 — Just a guess, but it could be due to the fact that the image is a .png. If the black outline is actually transparent in the original image, you could be seeing an artifact of Microsoft's original .png image handler which didn't do well with .png transparency as I recall. You might try converting the image to .gif as a test.

Does the image need to rotate dynamically? You could use software on the server to handle the rotation on demand. It would be slower than JavaScript alone, but it would be more reliable.
Copy linkTweet thisAlerts:
@hguserauthorDec 07.2012 — Does the image need to rotate dynamically? [/QUOTE]

Yes.

We have to change the rotatation according to the data by server.

You can find some details about our application here;
Copy linkTweet thisAlerts:
@rtretheweyDec 07.2012 — If I understand correctly, you're creating an interactive map where the map is overlaid with an image of a car and both images get updated as needed. While you could continually update both elements from their respective servers, I'd be inclined to create a set of images of the car - each one showing the car at a different angle of rotation. You could then pre-load the set of images in the browser and simply change the 'src' property of the image with JavaScript as desired with no load on the server or the Internet connection, and no browser issues. Is that possible with your implementation?
×

Success!

Help @hguser spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.15,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...