Cross browser way to rotate image using CSS? CSS to rotate by 45 degrees: .desk { width: 50%; height: 400px; margin: 5em auto; border: solid 1px #000; overflow: visible; } .desk img { behavior:url(; /* Firefox */ -moz-transform:rotate(45deg); /* Safari and Chrome */ -webkit-transform:rotate(45deg); /* Opera */ -o-transform:rotate(45deg); /* IE9 */ -ms-transform:rotate(45deg); /* IE6,IE7 */ filter: progid:DXImageTransform.Microsoft.Matrix(sizingMethod=’auto expand’, M11=0.7071067811865476, M12=-0.7071067811865475, M21=0.7071067811865475, M22=0.7071067811865476); … Read more

Rotate Image around character (JAVA)

You mean something like… (Please note, the red line is a guide line to indicate the angle from the center, you won’t need it ;)) The fancy, pancy stuff is in the getSwordHandlePoint method, which calculates the point along the vector at which the handle should be placed… public class TestSword { public static void … Read more

Moving forward after angle change. Pygame

To move the tank in the direction which is faced, wirte a method, that computes a direction vector, dependent on an velocity argument and the self.angle attribute. The nagle and the velocity define a vector by Polar coordinats. Add the vector to it’s current position (self.pos). Finally update the self.rect attribute by the position: class … Read more

Rotate an YUV byte array on Android

The following method can rotate a YUV420 byte array by 90 degree. private byte[] rotateYUV420Degree90(byte[] data, int imageWidth, int imageHeight) { byte [] yuv = new byte[imageWidth*imageHeight*3/2]; // Rotate the Y luma int i = 0; for(int x = 0;x < imageWidth;x++) { for(int y = imageHeight-1;y >= 0;y–) { yuv[i] = data[y*imageWidth+x]; i++; } … Read more

How to use 4d rotors

The most common way to represent goemetric algebra multivectors (including rotors) in a computer is via an array of coefficients, one for each canonical form algebra basis element (canonical basis blade) ie. for a 4D basis space you will have a 2^4 dimensional algebra and have 2^4 dimensional array of coefficients. An alternate but probably … Read more

CSS3 transition on click using pure CSS

If you want a css only solution you can use active .crossRotate:active { transform: rotate(45deg); -webkit-transform: rotate(45deg); -ms-transform: rotate(45deg); } But the transformation will not persist when the activity moves. For that you need javascript (jquery click and css is the cleanest IMO). $( “.crossRotate” ).click(function() { if ( $( this ).css( “transform” ) == … Read more