Вверх ↑
Ответов: 126
Mafia
Консильери
#1: 2019-12-19 20:34:27 ЛС | профиль | цитата
tauras, попробуй этот:

Код

function init(){
d = display
c = color
c0 = c.rgb(000, 170, 000)
c1 = c.rgb(255, 000, 000)
c2 = c.rgb(000, 255, 000)
c3 = c.rgb(000, 000, 255)
c4 = c.rgb(255, 255, 000)
c5 = c.rgb(000, 255, 255)
c6 = c.rgb(255, 000, 255)
circles = []
colors = [
c0, c0, c0, c0, c0, c0,
c0, c0, c0, c0, c0, c0,
c1, c2, c3, c4, c5, c6]
for(var i = 0; i ‹ 16; i++){
add_circle(8 - 8 / 15 * i, i * 2, 31 - i * 2, 1 / 5000 * (i % 2 ? 1 : -1))
}
}
function add_circle(radius, height, number, speed){
circle = {
radius : radius,
speed : speed,
voxels : []
}
for(var i = 0; i ‹ number; i++){
circle.voxels.push(d.voxel(0, height, 0, c0))
}
circles.push(circle)
}
function update(time){
circles.forEach(function(circle){
solo_angle = 360 / circle.voxels.length * (Math.PI / 180)
circle.voxels.forEach(function(voxel, i){
angle = (solo_angle * i + time * circle.speed) % 360
x = Math.cos(angle) - Math.sin(angle)
z = Math.sin(angle) + Math.cos(angle)
voxel.cursorX = x * circle.radius + 7.5
voxel.cursorZ = z * circle.radius + 7.5
if(Math.random() › 0.99){
voxel.color = colors[Math.floor(Math.random() * colors.length)]
}
})
})
}
карма: -4
0