richmond62 wrote: ↑Mon Mar 04, 2024 4:24 pm
motion is fairly smooth regardless of whether one uses 'move to' or 'set the loc'.
Wasn't talking about motion, I was talking about the entire speed of the script.
18462 milliseconds to finish Action 1 with
Move statement
1281 milliseconds to finish Action 1 with
move statement commented and replaced with
set the loc
That's a HUGE difference. Just think how much more time you could spend in the garden if you get things done with
"Software at the speed of light" lol.
To smooth things out when doing weird random stuff, you have to add more points...how is that done?
Take point A add to point B and divided by 2 to get the halfway point.
Also probably not throwing everything into a field would help alot.
I stuck a field into my 3D thing to check some numbers and was like walking in wet cement.
Double the points, 2676 milliseconds to completion, no field because tying QUONT to the field line, ties it to the size of the graphic since add 1 to QUONT to hold each extra bit. Oh turn on, markers, that's a great way to see the complexity of the graphic.
Code: Select all
on mouseUp
set the vis of grc "BLOB" to true
set the moveSpeed to 1000
put empty into fld "POYNTS"
put 0.1 into STEPP
put 1 into QOUNT
put the milliseconds into ms
repeat until STEPP > 63
put the milliseconds -ms into field "TIME"
put (sin(STEPP)) into LRLOC
put (cos(STEPP)) into UDLOC
put QOUNT/2 into XYZ
put 25 into S1
put 25 into S2
put ((LRLOC * XYZ)+ 375 + S1) into LRLOC
put ((UDLOC * XYZ)+ 375 + S2) into UDLOC
if lastX is a number then
put (lastX+LRLOC)/2 into midX
put (lastY+UDLOC)/2 into midY
put cr & midx,midy after tPoints
--add 1 to QOUNT
end if
put LRLOC into lastX
put UDLOC into lastY
put cr & (LRLOC & "," & UDLOC) after tPoints
set the points of grc "TRAK" to tPoints
set the loc of grc "BLOB" to (LRLOC & "," & UDLOC)
add 0.1 to STEPP
add 1 to QOUNT
end repeat
set the vis of grc "BLOB" to false
set the layer of grc "TRAK" to bottom
end mouseUp
also there's so more you can do with silly sines... in 3D!
- MagneticField.gif (478.53 KiB) Viewed 981 times
This is just modifcation of example...3 from one of those stacks
Code: Select all
on DefineMagneticField
put 0.1 into STEPP
put 1 into N
repeat until STEPP > 63
put (sin(STEPP)) into X
put ((cos(STEPP)) * (sin(STEPP))) into Y
-- Generate a z-coordinate (depth) based on QOUNT
put N/2 into Z
put 60 into S1
put 60 into S2
--put ((X * (60 - Z)) + 60 + S1) into D
--put ((Y * Z) + 60 + S2) into D
put (X*(N/10)) into waveX
put (Y*(N/10)) into waveY
setXYZ "MagneticField","X",N,waveX*2
setXYZ "MagneticField","Y",N,waveY*2
setXYZ "MagneticField","Z",N,60+ Z*(sin(N)/10) ---(cos(N)*((waveX+waveY)/2))
add 0.1 to STEPP
add 1 to N
end repeat
end DefineMagneticField
on setXYZ tobject,XYZ,n,tval
put "xyz"&tObject&"Array" into tArrayName
put the tArrayName of of stack (the mainStack of this stack) into tArray
put tArray[xyz] into subArray
put tVal into subArray[n]
put subArray into tArray[xyz]
set the tArrayName of of stack (the mainStack of this stack) to tArray
end setXYZ
function getXYZ tobject,xyz,n
put "xyz"&tObject&"Array" into tArrayName
put the tArrayName of of stack (the mainStack of this stack) into tArray
put tArray[xyz] into subArray
return subArray[n]
end getXYZ
The setXYZ handler will store your 3D data, and the getXYZ handler will retrieve it, obviously.
You'll need a bunch of stuff from my 3D stack to make it do things though...but those are handy handlers.