0
$\begingroup$

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?

$\endgroup$
  • $\begingroup$ You can use Inset or Texture. $\endgroup$ – Kuba Jan 30 '14 at 18:36
  • 1
    $\begingroup$ There are special commands for dealing with image objects such as ImageRotate. $\endgroup$ – bill s Jan 30 '14 at 18:36
  • $\begingroup$ Okay, but I also need to transform my image in the way it is done with primitives :) $\endgroup$ – Bogdan Jan 30 '14 at 18:37
3
$\begingroup$
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

$\endgroup$
  • 1
    $\begingroup$ No images? Me too lazy to evaluate! $\endgroup$ – Yves Klett Jan 30 '14 at 18:46
  • $\begingroup$ @YvesKlett uploading ... $\endgroup$ – Dr. belisarius Jan 30 '14 at 18:47
  • $\begingroup$ You be using an acoustic coupler modem? $\endgroup$ – Yves Klett Jan 30 '14 at 18:50
  • $\begingroup$ @YvesKlett Just a standard third world inet uplink $\endgroup$ – Dr. belisarius Jan 30 '14 at 18:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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