Notifications
Clear all

[Closed] question about animation

Hello,
could someone explain if it is possible to animate and render the animation of the following line creation ?

thank you

 
------------------------------------------------------------------------------------------- 
-- rounds a value to n decimal places 
fn round_to val n = 
(
local mult = 10.0 ^ n
(floor ((val * mult) + 0.5)) / mult
)
--line function
fn drawLineBetweenTwoPoints pointA pointB =
(
-- format "drawLineBetweenTwoPoints
"
-- format " pointA: %, pointB: %
" pointA pointB
local lLine = SplineShape pos: PointA
addNewSpline lLine
addKnot lLine 1 #corner #line PointA
addKnot lLine 1 #corner #line PointB
 
lLine.DisplayRenderMesh =true
lLine.UseViewportSettings = false
lLine.DisplayRenderSettings = true
-- lLine.renderable = true
-- lLine.baseobject.renderable = true
 
updateShape lLine
 
return lLine
)
--------------------------------------------------------------------------------------------
fn create_lines range1 range2 gen=
(
seed = 12345
local range1 = 150
local range2 = 150
local gen = 200
 
local x = 50 , y = 50 , xn = 50 , yn = 50
 
for i in 1 to gen do
(
if (float)(random 0 1)>0.5 then
x = x + random -50 50
else 
y = y + random -50 50
--x = (round_to x 0 ) as integer 
--y = (round_to y 0) as integer 
if ((x>0 AND x < range1)AND(y>0 AND y < range2))do
(
--create the line
ln = drawLineBetweenTwoPoints [x,y,0] [xn,yn,0]
--assing new ends
p = point position: [x,y,0] box:true
xn = x
yn = y
select (for o in objects where classof o == splineShape collect o)
selectmore(for o in objects where classof o == Point collect o)
--(for o in objects where classof o== Point collect o)
)
)
)
global RandomMovement
try( DestroyDialog RandomMovement )
catch()
rollout RandomMovement "RMovement"
(
group "Field Range" 
(
spinner spn_range1 "Range1" type:#integer range:[-10000,10000,500]
spinner spn_range2 "Range2" type:#integer range:[-10000,10000,500]
spinner spn_gener "Generations" type:#integer range:[-1000,1000, 20]
)
 
group "Create"
(
button but_drawlines "Draw Lines"
)
 
on but_drawlines pressed do
(
with undo on
(
create_lines spn_range1.value spn_range2.value spn_gener.value
)
)
)
try (
-- close existing rolloutFloater
closeRolloutFloater RandomMovement
) catch ()
createDialog RandomMovement 200 140