From 416c2b4ceeaa80aff87377ce4fa3497d6925ac3a Mon Sep 17 00:00:00 2001 From: _darch Date: Thu, 15 Apr 2021 17:30:39 +0200 Subject: [PATCH 1/2] Create textures.pz slideshow([:list, :of, :images], slideshow_speed, animation_speed) Sane defaults are set for both speeds, so they can be omitted. --- stdlib/textures.pz | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/stdlib/textures.pz b/stdlib/textures.pz index 2c6c4f9..d26b47b 100644 --- a/stdlib/textures.pz +++ b/stdlib/textures.pz @@ -24,3 +24,9 @@ func animate(name, speed, &blk) intMaterial(:material, :texture) blk(frame) popScope() + +func slideshow(image_list, slideshow_speed, animation_speed) + slideshow_speed := 1 + image = image_list[(slideshow_speed * time) % length(image_list)] + animation_speed := 10 + animate(image, animation_speed) From f8b1d080ee35307fb2bb5758761d66f4d5237d4c Mon Sep 17 00:00:00 2001 From: _darch Date: Sat, 24 Apr 2021 10:35:42 +0200 Subject: [PATCH 2/2] adding block support to slideshow() --- stdlib/textures.pz | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/stdlib/textures.pz b/stdlib/textures.pz index d26b47b..157d4a7 100644 --- a/stdlib/textures.pz +++ b/stdlib/textures.pz @@ -25,8 +25,13 @@ func animate(name, speed, &blk) blk(frame) popScope() -func slideshow(image_list, slideshow_speed, animation_speed) +func slideshow(image_list, slideshow_speed, animation_speed, &blk) slideshow_speed := 1 image = image_list[(slideshow_speed * time) % length(image_list)] animation_speed := 10 - animate(image, animation_speed) + if (isNull(blk)) + animate(image, animation_speed) + else + animate(image, animation_speed) + blk() +