Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Sinusoid board (just for fun) — Gideros Forum

Sinusoid board (just for fun)

dr_maxdr_max Member
edited October 2013 in General questions
some minutes fast coding )
--[[
by Doctor Max
maxim.krassa@gmail.com
--]]
 
shape = Shape.new()
 
dx1 = 0
dx2 = 0
 
params = {
0.006, 0.0001, 0.00004, 0.00007,
0.02,0.03, 0.0001, 0.00,
0.9,0.3, 0.00001, 0.00004
}
 
t = 0
 
local function onEnterFrame(event)
		tdx1 = dx1
		tdx2 = dx2
		shape:clear()
		shape:setLineStyle(1, 0x0070ff)
 
		if t < 800 then
			p = 1
		elseif t < 1600 then
			p = 5
		else
			p = 9
		end
 
	for y = 1, 240  do
		cx = math.sin(tdx1)*100 + math.cos(tdx2)*100
		shape:beginPath()
		shape:moveTo( 0, y)
		shape:lineTo( cx + 200, y)
		shape:endPath()
		tdx1 = tdx1 + params[p]
		tdx2 = tdx2 + params[p + 1]
		dx1 = dx1 + params[p + 2]
		dx2 = dx2 + params[p + 3]
	end
	t = t + 1
end
 
application:setBackgroundColor(0x0000ff)
application:setOrientation(Application.LANDSCAPE_RIGHT)
 
stage:addChild(shape)
stage:addEventListener(Event.ENTER_FRAME, onEnterFrame)
Thanx for watching!

Video:


Likes: aditya, talis, phongtt

+1 -1 (+3 / -0 )Share on Facebook

Comments

Sign In or Register to comment.