Skip to content

Instantly share code, notes, and snippets.

@extrawurst
Created November 9, 2020 20:33
Show Gist options
  • Save extrawurst/d26842f0dfc3b51e1dffba8248065648 to your computer and use it in GitHub Desktop.
Save extrawurst/d26842f0dfc3b51e1dffba8248065648 to your computer and use it in GitHub Desktop.
extends CanvasItem
# how many lines to draw? (this can be adjusted from the editor UI)
export var cnt = 6000
# this is the center point
export var start = Vector2(250,250)
# radius (line length)
export var rad = 200
func _draw():
# lets measure the runtime
var startTime = OS.get_ticks_usec()
var cntf = float(cnt)
for n in range(cnt):
var x = sin(n/cntf * 360.0)*rad
var y = cos(n/cntf * 360.0)*rad
draw_line(
start,
start+Vector2(x, y),
Color(255, 0, 0),
1,
false)
print("bench: " + String(OS.get_ticks_usec() - startTime))
func _process(_delta):
update()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment