; The GIMP -- an image manipulation program ; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; ; This program is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation; either version 2 of the License, or ; (at your option) any later version. ; ; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with this program; if not, write to the Free Software ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; ; ; $Id: dlspin.scm,v 1.1 1998/01/04 10:29:06 dl Exp $ ; ; Makes a copy of your image and creates an animation of the active layer ; The animation may be saved with the gif-plug-in. (define (script-fu-spinanim img drawable type num-frames phase) (let* ((num-frames (max 1 num-frames)) (remaining-frames num-frames) (phaseshift (/ 360 num-frames)) (image (car (gimp-channel-ops-duplicate img)))) (gimp-image-disable-undo image) (set! source-layer (car (gimp-image-get-active-layer image))) (while (> remaining-frames 0) (set! anim-layer (car (gimp-layer-copy source-layer TRUE))) (gimp-layer-set-preserve-trans anim-layer FALSE) (gimp-image-add-layer image anim-layer -1) (set! layer-name (string-append "Frame " (number->string (- (+ num-frames 1) remaining-frames) 10))) (gimp-layer-set-name anim-layer layer-name) (plug-in-map-object 1 image anim-layer type 0.5 0.5 2.0 ; viewpoint 0.5 0.5 0.0 ; position 1.0 0.0 0.0 ; firstaxis 0.0 1.0 0.0 ; second axis 0.0 phase 0.0 ; alpha,beta,gamma 0 '(1 1 1) ; light type and color -0.5 -0.5 2.0 ; light pos -1.0 -1.0 1.0 ; light direction 0.6 1.0 0.5 0.4 10.0 ; material TRUE FALSE FALSE TRUE 0.5 ; radius ) (set! remaining-frames (- remaining-frames 1)) (set! phase (- phase phaseshift))) (gimp-image-remove-layer image source-layer) (gimp-image-enable-undo image) (gimp-display-new image))) (script-fu-register "script-fu-spinanim" "/Script-Fu/Animators/Spin" "Animates an image by mapping it onto a rotating sphere or plane" "Scott Goehring (scott@poverty.bloomington.in.us) and Laurent Demailly (L@demailly.com)" "Scott Goehring + Laurent Demailly" "11/9/97" "RGB RGBA GRAY GRAYA" SF-IMAGE "Image" 0 SF-DRAWABLE "Drawable" 0 SF-TOGGLE "Sphere(1) or Plane(0)" 1 SF-VALUE "Number of Frames" "12" SF-VALUE "Initial phase (deg)" "5" )