2006-12-10 05:33:38 +08:00
|
|
|
; GIMP - The GNU Image Manipulation Program
|
1997-11-25 06:05:25 +08:00
|
|
|
; Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
2006-10-16 09:08:54 +08:00
|
|
|
;
|
2009-01-18 06:28:01 +08:00
|
|
|
; This program is free software: you can redistribute it and/or modify
|
1997-11-25 06:05:25 +08:00
|
|
|
; it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
; the Free Software Foundation; either version 3 of the License, or
|
2006-10-16 09:08:54 +08:00
|
|
|
; (at your option) any later version.
|
|
|
|
;
|
1997-11-25 06:05:25 +08:00
|
|
|
; 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.
|
2006-10-16 09:08:54 +08:00
|
|
|
;
|
1997-11-25 06:05:25 +08:00
|
|
|
; You should have received a copy of the GNU General Public License
|
2018-07-12 05:27:07 +08:00
|
|
|
; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
1997-11-25 06:05:25 +08:00
|
|
|
;
|
|
|
|
;
|
1999-12-21 21:57:58 +08:00
|
|
|
; waves-anim.scm version 1.01 1997/12/13
|
1998-02-17 22:27:46 +08:00
|
|
|
;
|
|
|
|
; CHANGE-LOG:
|
|
|
|
; 1.00 - initial release
|
|
|
|
; 1.01 - some code cleanup, no real changes
|
1997-11-25 06:05:25 +08:00
|
|
|
;
|
1999-12-21 21:57:58 +08:00
|
|
|
; Copyright (C) 1997 Sven Neumann <sven@gimp.org>
|
2006-10-16 09:08:54 +08:00
|
|
|
;
|
|
|
|
;
|
1997-11-25 06:05:25 +08:00
|
|
|
; Makes a copy of your image and creates an animation of the active layer
|
2006-10-16 09:08:54 +08:00
|
|
|
; as if a stone was thrown into the image. The animation may be saved with
|
|
|
|
; the gif-plug-in.
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1998-11-15 04:46:25 +08:00
|
|
|
(define (script-fu-waves-anim img
|
2024-09-13 03:01:15 +08:00
|
|
|
drawables
|
2006-10-16 09:08:54 +08:00
|
|
|
amplitude
|
|
|
|
wavelength
|
|
|
|
num-frames
|
|
|
|
invert)
|
1997-11-25 06:05:25 +08:00
|
|
|
(let* ((amplitude (max 0 amplitude))
|
2006-10-16 09:08:54 +08:00
|
|
|
(wavelength (max 0 wavelength))
|
|
|
|
(num-frames (max 1 num-frames))
|
|
|
|
(remaining-frames num-frames)
|
|
|
|
(phase 0)
|
|
|
|
(phaseshift (/ 360 num-frames))
|
2001-06-13 03:23:07 +08:00
|
|
|
(image (car (gimp-image-duplicate img)))
|
2022-08-03 04:40:08 +08:00
|
|
|
(source-layer (aref (cadr (gimp-image-get-selected-layers image)) 0)))
|
2006-10-16 09:08:54 +08:00
|
|
|
|
1999-10-17 08:07:55 +08:00
|
|
|
(gimp-image-undo-disable image)
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
(if (= invert TRUE)
|
|
|
|
(set! phaseshift (- 0 phaseshift)))
|
2006-10-16 09:08:54 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
(while (> remaining-frames 1)
|
2006-10-16 09:08:54 +08:00
|
|
|
(let* (
|
|
|
|
(waves-layer (car (gimp-layer-copy source-layer TRUE)))
|
|
|
|
(layer-name (string-append "Frame "
|
|
|
|
(number->string
|
|
|
|
(- (+ num-frames 2)
|
|
|
|
remaining-frames) 10
|
|
|
|
)
|
|
|
|
" (replace)"))
|
|
|
|
)
|
|
|
|
(gimp-layer-set-lock-alpha waves-layer FALSE)
|
2011-03-02 15:55:43 +08:00
|
|
|
(gimp-image-insert-layer image waves-layer 0 -1)
|
2010-08-03 05:13:51 +08:00
|
|
|
(gimp-item-set-name waves-layer layer-name)
|
2006-10-16 09:08:54 +08:00
|
|
|
|
2007-10-02 03:44:23 +08:00
|
|
|
(plug-in-waves RUN-NONINTERACTIVE
|
2006-10-16 09:08:54 +08:00
|
|
|
image
|
|
|
|
waves-layer
|
|
|
|
amplitude
|
|
|
|
phase
|
|
|
|
wavelength
|
|
|
|
0
|
|
|
|
FALSE)
|
|
|
|
|
|
|
|
(set! remaining-frames (- remaining-frames 1))
|
|
|
|
(set! phase (- phase phaseshift))
|
|
|
|
)
|
|
|
|
)
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2010-08-03 05:13:51 +08:00
|
|
|
(gimp-item-set-name source-layer "Frame 1")
|
2007-10-02 03:44:23 +08:00
|
|
|
(plug-in-waves RUN-NONINTERACTIVE
|
2006-10-16 09:08:54 +08:00
|
|
|
image
|
|
|
|
source-layer
|
|
|
|
amplitude
|
|
|
|
phase
|
|
|
|
wavelength
|
|
|
|
0
|
|
|
|
FALSE)
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-10-17 08:07:55 +08:00
|
|
|
(gimp-image-undo-enable image)
|
2006-10-21 01:55:14 +08:00
|
|
|
(gimp-display-new image)
|
|
|
|
)
|
|
|
|
)
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2024-09-13 03:01:15 +08:00
|
|
|
(script-fu-register-filter "script-fu-waves-anim"
|
2006-10-16 09:08:54 +08:00
|
|
|
_"_Waves..."
|
|
|
|
_"Create a multi-layer image with an effect like a stone was thrown into the current image"
|
|
|
|
"Sven Neumann <sven@gimp.org>"
|
|
|
|
"Sven Neumann"
|
|
|
|
"1997/13/12"
|
|
|
|
"RGB* GRAY*"
|
2024-09-13 03:01:15 +08:00
|
|
|
SF-ONE-OR-MORE-DRAWABLE
|
2007-07-11 17:07:45 +08:00
|
|
|
SF-ADJUSTMENT _"Amplitude" '(10 1 101 1 10 1 0)
|
|
|
|
SF-ADJUSTMENT _"Wavelength" '(10 0.1 100 1 10 1 0)
|
2006-10-16 09:08:54 +08:00
|
|
|
SF-ADJUSTMENT _"Number of frames" '(6 1 512 1 10 0 1)
|
|
|
|
SF-TOGGLE _"Invert direction" FALSE
|
|
|
|
)
|
2004-11-19 06:44:28 +08:00
|
|
|
|
|
|
|
(script-fu-menu-register "script-fu-waves-anim"
|
2023-03-29 05:43:11 +08:00
|
|
|
"<Image>/Filters/Animation/")
|