Data update
This commit is contained in:
parent
4d5544505c
commit
4924dd0264
3073 changed files with 55820 additions and 4408 deletions
|
|
@ -5,14 +5,13 @@ on animate
|
|||
incr = (incr + 0.05) mod 360
|
||||
x = 50
|
||||
y = 50
|
||||
glineto x y
|
||||
length = 1
|
||||
angle = incr
|
||||
for i = 1 to 150
|
||||
xp = x
|
||||
yp = y
|
||||
x += cos angle * length
|
||||
y += sin angle * length
|
||||
gline xp yp x y
|
||||
glineto x y
|
||||
length += 1
|
||||
angle += incr
|
||||
.
|
||||
|
|
|
|||
42
Task/Polyspiral/REBOL/polyspiral.rebol
Normal file
42
Task/Polyspiral/REBOL/polyspiral.rebol
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
Rebol [
|
||||
title: "Rosetta code: Polyspiral"
|
||||
file: %Polyspiral.r3
|
||||
url: https://rosettacode.org/wiki/Polyspiral
|
||||
needs: 3.10.2
|
||||
note: [
|
||||
https://github.com/Oldes/Rebol3/releases
|
||||
https://github.com/Siskin-framework/Rebol-Blend2D
|
||||
]
|
||||
]
|
||||
import blend2d ;; Import Blend2D extension used to draw
|
||||
|
||||
incr: 0.0 ;; Initialize increment variable to 0.0
|
||||
image: make image! 800x800 ;; Create an 800x800 pixel image canvas
|
||||
pi2: 2 * PI ;; Calculate 2π (full circle in radians), for angle calculations
|
||||
random/seed 4
|
||||
|
||||
;; animation loop (repeats 4 times to create progressive spiral states)
|
||||
loop 4 [
|
||||
x: image/size/x / 2 ;; Set x to center of image (horizontal)
|
||||
y: image/size/y / 2 ;; Set y to center of image (vertical)
|
||||
length: 5 ;; Starting length/step for spiral arms
|
||||
incr: (incr + 5) % pi2 ;; Increment the angle step (modulo 2π to ensure it wraps correctly)
|
||||
angle: incr
|
||||
commands: clear [] ;; Clear previous drawing commands
|
||||
color: 100.100.100 + random 155.155.155
|
||||
append commands [line-width 1 pen :color line] ;; Start a new line with width 1 and random pen color
|
||||
|
||||
;; spiral loop (generates points for the spiral)
|
||||
loop 150 [
|
||||
x: x + (length * (cos angle)) ;; Move x along the current angle by current length
|
||||
y: y + (length * (sin angle)) ;; Move y along the current angle by current length
|
||||
append commands as-pair x y ;; Add the new (x, y) point to the command list
|
||||
length: length + 5 ;; Increase the step size for spiral effect
|
||||
angle: (angle + incr) % pi2 ;; Progress the angle for the spiral's curvature (modulo 2π)
|
||||
]
|
||||
|
||||
draw image commands ;; Render the spiral on the image with the accumulated commands
|
||||
]
|
||||
|
||||
try [save %polyspiral.png image] ;; Save the image as PNG
|
||||
try [view image] ;; Display the final image window with drawn spirals
|
||||
Loading…
Add table
Add a link
Reference in a new issue