Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have following animation:

Animate[
 Graphics[{Translate[Rotate[Rectangle[], ψ Degree], {x, 0}], 
   Translate[Rotate[Rectangle[], -ψ Degree], {1.75 - x, 0}]}],
 {x, 0, 1},
 {ψ, 0, 90},
 AnimationRunning -> False
 ]

enter image description here

For rectangles it works perfectly, but when I try to put any image instead of these rectangles, it shows me "Image is not a Graphics primitive or directive" error. How to put any image (raster-, vector- based) and transform it the way like it does with primitives?

share|improve this question
    
You can use Inset or Texture. –  Kuba Jan 30 at 18:36
1  
There are special commands for dealing with image objects such as ImageRotate. –  bill s Jan 30 at 18:36
    
Okay, but I also need to transform my image in the way it is done with primitives :) –  Bogdan Jan 30 at 18:37

1 Answer 1

t = Texture@ExampleData[{"TestImage", "Lena"}];
p = {t, Polygon[{{0, 0}, {0, 1}, {1, 1}, {1, 0}}, 
                VertexTextureCoordinates -> {{0, 0}, {0, 1}, {1, 1}, {1, 0}}]}; 
Animate[ Graphics[{Translate[Rotate[p, ψ Degree], {x, 0}], 
                   Translate[Rotate[p, -ψ Degree], {1.75 - x, 0}]}], 
       {x, 0, 1}, {ψ, 0, 90}, AnimationRunning -> False]

enter image description here

share|improve this answer
1  
No images? Me too lazy to evaluate! –  Yves Klett Jan 30 at 18:46
    
@YvesKlett uploading ... –  belisarius Jan 30 at 18:47
    
You be using an acoustic coupler modem? –  Yves Klett Jan 30 at 18:50
    
@YvesKlett Just a standard third world inet uplink –  belisarius Jan 30 at 18:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.